Merge branch 'master' into master
This commit is contained in:
56
tests/Configurations/LoadBalancerTest.php
Normal file
56
tests/Configurations/LoadBalancerTest.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Martijn Smidt <martijn@squeezely.tech>
|
||||
* User: HemeraOne
|
||||
* Date: 13/05/2019
|
||||
*/
|
||||
|
||||
use Cloudflare\API\Configurations\ConfigurationsException;
|
||||
use Cloudflare\API\Configurations\LoadBalancer;
|
||||
|
||||
class LoadBalancerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider testArgumentsDataProvider
|
||||
*/
|
||||
public function testArguments($setFunction, $arguments, $getFunction, $invalid)
|
||||
{
|
||||
$loadBalancer = new LoadBalancer('bogus', [], 'bogus');
|
||||
foreach ($arguments as $argument) {
|
||||
if ($invalid === true) {
|
||||
try {
|
||||
$loadBalancer->{$setFunction}($argument);
|
||||
} catch (ConfigurationsException $e) {
|
||||
$this->assertNotEquals($argument, $loadBalancer->{$getFunction}());
|
||||
}
|
||||
} elseif ($invalid === false) {
|
||||
$loadBalancer->{$setFunction}($argument);
|
||||
$this->assertEquals($argument, $loadBalancer->{$getFunction}());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testArgumentsDataProvider()
|
||||
{
|
||||
return [
|
||||
'steeringPolicy arguments valid' => [
|
||||
'setSteeringPolicy', ['off', 'geo', 'random', 'dynamic_latency', ''], 'getSteeringPolicy', false
|
||||
],
|
||||
'sessionAffinity arguments valid' => [
|
||||
'setSessionAffinity', ['none', 'cookie', 'ip_cookie', ''], 'getSessionAffinity', false
|
||||
],
|
||||
'sessionAffinityTtl arguments valid' => [
|
||||
'setSessionAffinityTtl', [3600], 'getSessionAffinityTtl', false
|
||||
],
|
||||
'steeringPolicy arguments invalid' => [
|
||||
'setSteeringPolicy', ['invalid'], 'getSteeringPolicy', true
|
||||
],
|
||||
'sessionAffinity arguments invalid' => [
|
||||
'setSessionAffinity', ['invalid'], 'getSessionAffinity', true
|
||||
],
|
||||
'sessionAffinityTtl arguments invalid' => [
|
||||
'setSessionAffinityTtl', [1337], 'getSessionAffinityTtl', true
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
53
tests/Configurations/PoolTest.php
Normal file
53
tests/Configurations/PoolTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Martijn Smidt <martijn@squeezely.tech>
|
||||
* User: HemeraOne
|
||||
* Date: 13/05/2019
|
||||
*/
|
||||
|
||||
use Cloudflare\API\Configurations\ConfigurationsException;
|
||||
use Cloudflare\API\Configurations\Pool;
|
||||
|
||||
class PoolTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider testArgumentsDataProvider
|
||||
*/
|
||||
public function testArguments($setFunction, $arguments, $getFunction, $invalid)
|
||||
{
|
||||
$pool = new Pool('bogus', []);
|
||||
foreach ($arguments as $argument) {
|
||||
if ($invalid) {
|
||||
try {
|
||||
$pool->{$setFunction}($argument);
|
||||
} catch (ConfigurationsException $e) {
|
||||
$this->assertNotEquals($argument, $pool->{$getFunction}());
|
||||
}
|
||||
} elseif ($invalid === false) {
|
||||
$pool->{$setFunction}($argument);
|
||||
$this->assertEquals($argument, $pool->{$getFunction}());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testArgumentsDataProvider()
|
||||
{
|
||||
return [
|
||||
'origins arguments valid' => [
|
||||
'setOrigins', [[['name' => 'test', 'address' => 'server1.example.com']]], 'getOrigins', false
|
||||
],
|
||||
'setNotificationEmail arguments valid' => [
|
||||
'setNotificationEmail', ['user@example.com'], 'getNotificationEmail', false
|
||||
],
|
||||
'origins arguments invalid no address' => [
|
||||
'setOrigins', [['name' => 'test']], 'getOrigins', true
|
||||
],
|
||||
'origins arguments invalid no name' => [
|
||||
'setOrigins', [['address' => 'server1.example.com']], 'getOrigins', true
|
||||
],
|
||||
'setNotificationEmail arguments invalid' => [
|
||||
'setNotificationEmail', ['userexample.com'], 'getNotificationEmail', true
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
82
tests/Endpoints/CryptoTest.php
Normal file
82
tests/Endpoints/CryptoTest.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
class CryptoTest extends TestCase
|
||||
{
|
||||
public function testGetOpportunisticEncryptionSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getOpportunisticEncryptionSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_encryption')
|
||||
);
|
||||
|
||||
$cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock);
|
||||
$result = $cryptoMock->getOpportunisticEncryptionSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testGetOnionRoutingSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getOnionRoutingSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_onion')
|
||||
);
|
||||
|
||||
$cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock);
|
||||
$result = $cryptoMock->getOnionRoutingSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testUpdateOpportunisticEncryptionSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateOpportunisticEncryptionSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_encryption'),
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock);
|
||||
$result = $cryptoMock->updateOpportunisticEncryptionSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateOnionRoutingSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateOnionRoutingSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/opportunistic_onion'),
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$cryptoMock = new \Cloudflare\API\Endpoints\Crypto($mock);
|
||||
$result = $cryptoMock->updateOnionRoutingSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,25 @@ class DNSTest extends TestCase
|
||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $dns->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testGetRecordID()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getRecordId.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records')
|
||||
);
|
||||
|
||||
$dns = new \Cloudflare\API\Endpoints\DNS($mock);
|
||||
$result = $dns->getRecordID('023e105f4ecef8ad9ca31a8372d0c353', 'A', 'example.com');
|
||||
|
||||
$this->assertEquals('372e67954025e0ba6aaa6d586b9e0b59', $result);
|
||||
}
|
||||
|
||||
public function testUpdateDNSRecord()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateDNSRecord.json');
|
||||
|
||||
121
tests/Endpoints/FirewallSettingsTest.php
Normal file
121
tests/Endpoints/FirewallSettingsTest.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
class FirewallSettingsTest extends TestCase
|
||||
{
|
||||
public function testGetSecurityLevelSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getSecurityLevelSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/security_level')
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->getSecurityLevelSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('medium', $result);
|
||||
}
|
||||
|
||||
public function testGetChallengeTTLSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getChallengeTTLSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/challenge_ttl')
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->getChallengeTTLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals(1800, $result);
|
||||
}
|
||||
|
||||
public function testGetBrowserIntegrityCheckSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getBrowserIntegrityCheckSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/browser_check')
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->getBrowserIntegrityCheckSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('on', $result);
|
||||
}
|
||||
|
||||
public function testUpdateSecurityLevelSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSecurityLevelSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/security_level'),
|
||||
$this->equalTo(['value' => 'medium'])
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->updateSecurityLevelSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'medium');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateChallengeTTLSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateChallengeTTLSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/challenge_ttl'),
|
||||
$this->equalTo(['value' => 1800])
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->updateChallengeTTLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 1800);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateBrowserIntegrityCheckSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateBrowserIntegrityCheckSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/browser_check'),
|
||||
$this->equalTo(['value' => 'on'])
|
||||
);
|
||||
|
||||
$firewallSettingsMock = new \Cloudflare\API\Endpoints\FirewallSettings($mock);
|
||||
$result = $firewallSettingsMock->updateBrowserIntegrityCheckSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'on');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
128
tests/Endpoints/LoadBalancersTest.php
Normal file
128
tests/Endpoints/LoadBalancersTest.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
use Cloudflare\API\Configurations\LoadBalancer;
|
||||
use Cloudflare\API\Endpoints\LoadBalancers;
|
||||
|
||||
/**
|
||||
* @author Martijn Smidt <martijn@squeezely.tech>
|
||||
* User: HemeraOne
|
||||
* Date: 13/05/2019
|
||||
*/
|
||||
|
||||
class LoadBalancersTest extends TestCase
|
||||
{
|
||||
public function testCreateLoadBalancer()
|
||||
{
|
||||
$pools = [
|
||||
'17b5962d775c646f3f9725cbc7a53df4',
|
||||
'9290f38c5d07c2e2f4df57b1f61d4196',
|
||||
'00920f38ce07c2e2f4df50b1f61d4194'
|
||||
];
|
||||
|
||||
$lbConfiguration = new LoadBalancer('www.example.com', $pools, '17b5962d775c646f3f9725cbc7a53df4');
|
||||
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/createLoadBalancer.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('post')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with(
|
||||
$this->equalTo('zones/699d98642c564d2e855e9661899b7252/load_balancers'),
|
||||
$lbConfiguration->getArray()
|
||||
);
|
||||
|
||||
$loadBalancers = new LoadBalancers($mock);
|
||||
$result = $loadBalancers->createLoadBalancer('699d98642c564d2e855e9661899b7252', $lbConfiguration);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('699d98642c564d2e855e9661899b7252', $loadBalancers->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testListLoadBalancer()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/listLoadBalancers.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/699d98642c564d2e855e9661899b7252/load_balancers')
|
||||
);
|
||||
|
||||
$loadBalancers = new LoadBalancers($mock);
|
||||
$loadBalancers->listLoadBalancers('699d98642c564d2e855e9661899b7252');
|
||||
$this->assertEquals('699d98642c564d2e855e9661899b7252', $loadBalancers->getBody()->result[0]->id);
|
||||
}
|
||||
|
||||
public function testGetLoadBalancerDetails()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getLoadBalancerDetails.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/699d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252')
|
||||
);
|
||||
|
||||
$loadBalancers = new LoadBalancers($mock);
|
||||
$loadBalancers->getLoadBalancerDetails('699d98642c564d2e855e9661899b7252', '699d98642c564d2e855e9661899b7252');
|
||||
$this->assertEquals('699d98642c564d2e855e9661899b7252', $loadBalancers->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testUpdateLoadBalancer()
|
||||
{
|
||||
$pools = [
|
||||
'17b5962d775c646f3f9725cbc7a53df4',
|
||||
'9290f38c5d07c2e2f4df57b1f61d4196',
|
||||
'00920f38ce07c2e2f4df50b1f61d4194'
|
||||
];
|
||||
|
||||
$lbConfiguration = new LoadBalancer('www.example.com', $pools, '17b5962d775c646f3f9725cbc7a53df4');
|
||||
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateLoadBalancer.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('put')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with(
|
||||
$this->equalTo('zones/699d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252'),
|
||||
$this->equalTo($lbConfiguration->getArray())
|
||||
);
|
||||
|
||||
$loadBalancers = new LoadBalancers($mock);
|
||||
$result = $loadBalancers->updateLoadBalancer('699d98642c564d2e855e9661899b7252', '699d98642c564d2e855e9661899b7252', $lbConfiguration);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('699d98642c564d2e855e9661899b7252', $loadBalancers->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testDeleteLoadBalancer()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteLoadBalancer.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('delete')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with(
|
||||
$this->equalTo('zones/699d98642c564d2e855e9661899b7252/load_balancers/699d98642c564d2e855e9661899b7252')
|
||||
);
|
||||
|
||||
$loadBalancers = new LoadBalancers($mock);
|
||||
$result = $loadBalancers->deleteLoadBalancer('699d98642c564d2e855e9661899b7252', '699d98642c564d2e855e9661899b7252');
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('699d98642c564d2e855e9661899b7252', $loadBalancers->getBody()->result->id);
|
||||
}
|
||||
}
|
||||
93
tests/Endpoints/MembershipTest.php
Normal file
93
tests/Endpoints/MembershipTest.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
|
||||
class MembershipTest extends TestCase
|
||||
{
|
||||
public function testListMemberships()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/listMemberships.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('memberships'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20,
|
||||
'account.name' => 'Demo Account',
|
||||
'status' => 'accepted',
|
||||
'order' => 'status',
|
||||
'direction' => 'desc',
|
||||
])
|
||||
);
|
||||
|
||||
$zones = new \Cloudflare\API\Endpoints\Membership($mock);
|
||||
$result = $zones->listMemberships('Demo Account', 'accepted', 1, 20, 'status', 'desc');
|
||||
|
||||
$this->assertObjectHasAttribute('result', $result);
|
||||
$this->assertObjectHasAttribute('result_info', $result);
|
||||
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $result->result[0]->id);
|
||||
$this->assertEquals(1, $result->result_info->page);
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $zones->getBody()->result[0]->id);
|
||||
}
|
||||
|
||||
public function testGetMembershipDetails()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getMembershipDetails.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$membership = new \Cloudflare\API\Endpoints\Membership($mock);
|
||||
$details = $membership->getMembershipDetails('4536bcfad5faccb111b47003c79917fa');
|
||||
|
||||
$this->assertObjectHasAttribute('id', $details);
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $details->id);
|
||||
$this->assertObjectHasAttribute('code', $details);
|
||||
$this->assertEquals('05dd05cce12bbed97c0d87cd78e89bc2fd41a6cee72f27f6fc84af2e45c0fac0', $details->code);
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $membership->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testUpdateMembershipDetails()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateMembershipStatus.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('put')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with(
|
||||
$this->equalTo('memberships/4536bcfad5faccb111b47003c79917fa'),
|
||||
$this->equalTo([
|
||||
'status' => 'accepted'
|
||||
])
|
||||
);
|
||||
|
||||
$membership = new \Cloudflare\API\Endpoints\Membership($mock);
|
||||
$membership->updateMembershipStatus('4536bcfad5faccb111b47003c79917fa', 'accepted');
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $membership->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testDeleteMembership()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteMembership.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('delete')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with($this->equalTo('memberships/4536bcfad5faccb111b47003c79917fa'));
|
||||
|
||||
$membership = new \Cloudflare\API\Endpoints\Membership($mock);
|
||||
|
||||
$membership->deleteMembership('4536bcfad5faccb111b47003c79917fa');
|
||||
|
||||
$this->assertEquals('4536bcfad5faccb111b47003c79917fa', $membership->getBody()->result->id);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class PageRulesTest extends TestCase
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
$this->equalTo([
|
||||
$this->equalTo([
|
||||
'status' => 'active',
|
||||
'order' => 'status',
|
||||
'direction' => 'desc',
|
||||
@@ -94,7 +94,7 @@ class PageRulesTest extends TestCase
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'),
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'),
|
||||
$this->equalTo([
|
||||
'targets' => $target->getArray(),
|
||||
'actions' => $action->getArray(),
|
||||
@@ -104,7 +104,7 @@ class PageRulesTest extends TestCase
|
||||
);
|
||||
|
||||
$pageRules = new \Cloudflare\API\Endpoints\PageRules($mock);
|
||||
$result = $pageRules->updatePageRule('023e105f4ecef8ad9ca31a8372d0c353', $target, $action, true, 1);
|
||||
$result = $pageRules->updatePageRule('023e105f4ecef8ad9ca31a8372d0c353', '9a7806061c88ada191ed06f989cc3dac', $target, $action, true, 1);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $pageRules->getBody()->result->id);
|
||||
|
||||
133
tests/Endpoints/PoolsTest.php
Normal file
133
tests/Endpoints/PoolsTest.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
use Cloudflare\API\Adapter\Adapter;
|
||||
use Cloudflare\API\Endpoints\Pools;
|
||||
|
||||
/**
|
||||
* @author Martijn Smidt <martijn@squeezely.tech>
|
||||
* User: HemeraOne
|
||||
* Date: 13/05/2019
|
||||
*/
|
||||
|
||||
class PoolsTest extends TestCase
|
||||
{
|
||||
public function testCreatePool()
|
||||
{
|
||||
$origins = [
|
||||
[
|
||||
'name' => 'app-server-1',
|
||||
'address' => '0.0.0.0',
|
||||
'enabled' => true,
|
||||
'weight' => 0.56
|
||||
]
|
||||
];
|
||||
|
||||
$poolConfiguration = new \Cloudflare\API\Configurations\Pool('primary-dc-1', $origins);
|
||||
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/createPool.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('post')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('post')
|
||||
->with(
|
||||
$this->equalTo('accounts/01a7362d577a6c3019a474fd6f485823/load_balancers/pools'),
|
||||
$poolConfiguration->getArray()
|
||||
);
|
||||
|
||||
$pools = new Pools($mock);
|
||||
$result = $pools->createPool('01a7362d577a6c3019a474fd6f485823', $poolConfiguration);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('17b5962d775c646f3f9725cbc7a53df4', $pools->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testListPools()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/listPools.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('accounts/01a7362d577a6c3019a474fd6f485823/load_balancers/pools')
|
||||
);
|
||||
|
||||
$pools = new Pools($mock);
|
||||
$pools->listPools('01a7362d577a6c3019a474fd6f485823');
|
||||
$this->assertEquals('17b5962d775c646f3f9725cbc7a53df4', $pools->getBody()->result[0]->id);
|
||||
}
|
||||
|
||||
public function testGetPoolDetails()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getPoolDetails.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('accounts/01a7362d577a6c3019a474fd6f485823/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4')
|
||||
);
|
||||
|
||||
$pools = new Pools($mock);
|
||||
$pools->getPoolDetails('01a7362d577a6c3019a474fd6f485823', '17b5962d775c646f3f9725cbc7a53df4');
|
||||
$this->assertEquals('17b5962d775c646f3f9725cbc7a53df4', $pools->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testUpdatePool()
|
||||
{
|
||||
$origins = [
|
||||
[
|
||||
'name' => 'app-server-1',
|
||||
'address' => '0.0.0.0',
|
||||
'enabled' => true,
|
||||
'weight' => 0.56
|
||||
]
|
||||
];
|
||||
|
||||
$poolConfiguration = new \Cloudflare\API\Configurations\Pool('primary-dc-1', $origins);
|
||||
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updatePool.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('put')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('put')
|
||||
->with(
|
||||
$this->equalTo('accounts/01a7362d577a6c3019a474fd6f485823/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4'),
|
||||
$this->equalTo($poolConfiguration->getArray())
|
||||
);
|
||||
|
||||
$pools = new Pools($mock);
|
||||
$result = $pools->updatePool('01a7362d577a6c3019a474fd6f485823', '17b5962d775c646f3f9725cbc7a53df4', $poolConfiguration);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('17b5962d775c646f3f9725cbc7a53df4', $pools->getBody()->result->id);
|
||||
}
|
||||
|
||||
public function testDeletePool()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/deletePool.json');
|
||||
|
||||
$mock = $this->getMockBuilder(Adapter::class)->getMock();
|
||||
$mock->method('delete')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with(
|
||||
$this->equalTo('accounts/01a7362d577a6c3019a474fd6f485823/load_balancers/pools/17b5962d775c646f3f9725cbc7a53df4')
|
||||
);
|
||||
|
||||
$pools = new Pools($mock);
|
||||
$result = $pools->deletePool('01a7362d577a6c3019a474fd6f485823', '17b5962d775c646f3f9725cbc7a53df4');
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('17b5962d775c646f3f9725cbc7a53df4', $pools->getBody()->result->id);
|
||||
}
|
||||
}
|
||||
161
tests/Endpoints/SSLTest.php
Normal file
161
tests/Endpoints/SSLTest.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
class SSLTest extends TestCase
|
||||
{
|
||||
public function testGetSSLSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getSSLSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/ssl')
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->getSSLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testGetSSLVerificationStatus()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getSSLVerificationStatus.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/ssl/verification')
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->getSSLVerificationStatus('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertObjectHasAttribute('result', $result);
|
||||
$this->assertEquals('active', $result->result{0}->certificate_status);
|
||||
}
|
||||
|
||||
public function testGetHTTPSRedirectSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getHTTPSRedirectSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/always_use_https')
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->getHTTPSRedirectSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testGetHTTPSRewritesSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getHTTPSRewritesSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/automatic_https_rewrites')
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->getHTTPSRewritesSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testUpdateSSLSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSSLSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/ssl'),
|
||||
$this->equalTo(['value' => 'full'])
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->updateSSLSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'full');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateHTTPSRedirectSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateHTTPSRedirectSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/always_use_https'),
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->updateHTTPSRedirectSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateHTTPSRewritesSetting()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateHTTPSRewritesSetting.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/automatic_https_rewrites'),
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->updateHTTPSRewritesSetting('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateSSLCertificatePackValidationMethod()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateSSLCertificatePackValidationMethod.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/ssl/verification/a77f8bd7-3b47-46b4-a6f1-75cf98109948'),
|
||||
$this->equalTo(['validation_method' => 'txt'])
|
||||
);
|
||||
|
||||
$sslMock = new \Cloudflare\API\Endpoints\SSL($mock);
|
||||
$result = $sslMock->updateSSLCertificatePackValidationMethod('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'a77f8bd7-3b47-46b4-a6f1-75cf98109948', 'txt');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,25 @@
|
||||
|
||||
class TLSTest extends TestCase
|
||||
{
|
||||
public function testGetTLSClientAuth()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getTLSClientAuth.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/tls_client_auth')
|
||||
);
|
||||
|
||||
$tlsMock = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $tlsMock->getTLSClientAuth('c2547eb745079dac9320b638f5e225cf483cc5cfdda41');
|
||||
|
||||
$this->assertEquals('off', $result);
|
||||
}
|
||||
|
||||
public function testEnableTLS13()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/enableTLS13.json');
|
||||
@@ -23,8 +42,8 @@ class TLSTest extends TestCase
|
||||
$this->equalTo(['value' => 'on'])
|
||||
);
|
||||
|
||||
$zoneTLSSettings = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $zoneTLSSettings->enableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true);
|
||||
$tlsMock = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $tlsMock->enableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -43,8 +62,8 @@ class TLSTest extends TestCase
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$zoneTLSSettings = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $zoneTLSSettings->disableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true);
|
||||
$tlsMock = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $tlsMock->disableTLS13('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', true);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -63,8 +82,28 @@ class TLSTest extends TestCase
|
||||
$this->equalTo(['value' => '1.1'])
|
||||
);
|
||||
|
||||
$zoneTLSSettings = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $zoneTLSSettings->changeMinimumTLSVersion('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', '1.1');
|
||||
$tlsMock = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $tlsMock->changeMinimumTLSVersion('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', '1.1');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateTLSClientAuth()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/updateTLSClientAuth.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('patch')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('patch')
|
||||
->with(
|
||||
$this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/settings/tls_client_auth'),
|
||||
$this->equalTo(['value' => 'off'])
|
||||
);
|
||||
|
||||
$tlsMock = new \Cloudflare\API\Endpoints\TLS($mock);
|
||||
$result = $tlsMock->updateTLSClientAuth('c2547eb745079dac9320b638f5e225cf483cc5cfdda41', 'off');
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ class UARulesTest extends TestCase
|
||||
->method('get')
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'),
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20
|
||||
])
|
||||
$this->equalTo([
|
||||
'page' => 1,
|
||||
'per_page' => 20
|
||||
])
|
||||
);
|
||||
|
||||
$zones = new \Cloudflare\API\Endpoints\UARules($mock);
|
||||
|
||||
19
tests/Endpoints/ZoneDeleteTest.php
Normal file
19
tests/Endpoints/ZoneDeleteTest.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
class ZoneDeleteTest extends TestCase
|
||||
{
|
||||
public function testDeleteTest()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/deleteZoneTest.json');
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('delete')->willReturn($response);
|
||||
$mock->expects($this->once())
|
||||
->method('delete')
|
||||
->with(
|
||||
$this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353')
|
||||
);
|
||||
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
||||
$result = $zones->deleteZone('023e105f4ecef8ad9ca31a8372d0c353');
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals('9a7806061c88ada191ed06f989cc3dac', $zones->getBody()->result->id);
|
||||
}
|
||||
}
|
||||
@@ -125,6 +125,25 @@ class ZonesTest extends TestCase
|
||||
$this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result[0]->id);
|
||||
}
|
||||
|
||||
public function testGetZoneByID()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getZoneById.json');
|
||||
|
||||
$mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock();
|
||||
$mock->method('get')->willReturn($response);
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353'));
|
||||
|
||||
$zones = new \Cloudflare\API\Endpoints\Zones($mock);
|
||||
$result = $zones->getZoneById('023e105f4ecef8ad9ca31a8372d0c353');
|
||||
|
||||
$this->assertInstanceOf(\stdClass::class, $result);
|
||||
$this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $zones->getBody()->result->id);
|
||||
$this->assertEquals('example.com', $zones->getBody()->result->name);
|
||||
}
|
||||
|
||||
public function testGetZoneID()
|
||||
{
|
||||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/getZoneId.json');
|
||||
|
||||
46
tests/Fixtures/Endpoints/createLoadBalancer.json
Normal file
46
tests/Fixtures/Endpoints/createLoadBalancer.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "699d98642c564d2e855e9661899b7252",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Load Balancer for www.example.com",
|
||||
"name": "www.example.com",
|
||||
"enabled": true,
|
||||
"ttl": 30,
|
||||
"fallback_pool": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"default_pools": [
|
||||
"17b5962d775c646f3f9725cbc7a53df4",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196",
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
],
|
||||
"region_pools": {
|
||||
"WNAM": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"ENAM": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"pop_pools": {
|
||||
"LAX": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"LHR": [
|
||||
"abd90f38ced07c2e2f4df50b1f61d4194",
|
||||
"f9138c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"SJC": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"proxied": true,
|
||||
"steering_policy": "dynamic_latency",
|
||||
"session_affinity": "cookie",
|
||||
"session_affinity_ttl": 5000
|
||||
}
|
||||
}
|
||||
28
tests/Fixtures/Endpoints/createPool.json
Normal file
28
tests/Fixtures/Endpoints/createPool.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Primary data center - Provider XYZ",
|
||||
"name": "primary-dc-1",
|
||||
"enabled": true,
|
||||
"minimum_origins": 2,
|
||||
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
|
||||
"check_regions": [
|
||||
"WEU",
|
||||
"ENAM"
|
||||
],
|
||||
"origins": [
|
||||
{
|
||||
"name": "app-server-1",
|
||||
"address": "0.0.0.0",
|
||||
"enabled": true,
|
||||
"weight": 0.56
|
||||
}
|
||||
],
|
||||
"notification_email": "someone@example.com"
|
||||
}
|
||||
}
|
||||
8
tests/Fixtures/Endpoints/deleteLoadBalancer.json
Normal file
8
tests/Fixtures/Endpoints/deleteLoadBalancer.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "699d98642c564d2e855e9661899b7252"
|
||||
}
|
||||
}
|
||||
8
tests/Fixtures/Endpoints/deleteMembership.json
Normal file
8
tests/Fixtures/Endpoints/deleteMembership.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "4536bcfad5faccb111b47003c79917fa"
|
||||
}
|
||||
}
|
||||
8
tests/Fixtures/Endpoints/deletePool.json
Normal file
8
tests/Fixtures/Endpoints/deletePool.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "17b5962d775c646f3f9725cbc7a53df4"
|
||||
}
|
||||
}
|
||||
8
tests/Fixtures/Endpoints/deleteZoneTest.json
Normal file
8
tests/Fixtures/Endpoints/deleteZoneTest.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "9a7806061c88ada191ed06f989cc3dac"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "browser_check",
|
||||
"value": "on",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/getChallengeTTLSetting.json
Normal file
11
tests/Fixtures/Endpoints/getChallengeTTLSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "challenge_ttl",
|
||||
"value": 1800,
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/getHTTPSRedirectSetting.json
Normal file
6
tests/Fixtures/Endpoints/getHTTPSRedirectSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/getHTTPSRewritesSetting.json
Normal file
6
tests/Fixtures/Endpoints/getHTTPSRewritesSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
46
tests/Fixtures/Endpoints/getLoadBalancerDetails.json
Normal file
46
tests/Fixtures/Endpoints/getLoadBalancerDetails.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "699d98642c564d2e855e9661899b7252",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Load Balancer for www.example.com",
|
||||
"name": "www.example.com",
|
||||
"enabled": true,
|
||||
"ttl": 30,
|
||||
"fallback_pool": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"default_pools": [
|
||||
"17b5962d775c646f3f9725cbc7a53df4",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196",
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
],
|
||||
"region_pools": {
|
||||
"WNAM": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"ENAM": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"pop_pools": {
|
||||
"LAX": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"LHR": [
|
||||
"abd90f38ced07c2e2f4df50b1f61d4194",
|
||||
"f9138c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"SJC": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"proxied": true,
|
||||
"steering_policy": "dynamic_latency",
|
||||
"session_affinity": "cookie",
|
||||
"session_affinity_ttl": 5000
|
||||
}
|
||||
}
|
||||
70
tests/Fixtures/Endpoints/getMembershipDetails.json
Normal file
70
tests/Fixtures/Endpoints/getMembershipDetails.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "4536bcfad5faccb111b47003c79917fa",
|
||||
"code": "05dd05cce12bbed97c0d87cd78e89bc2fd41a6cee72f27f6fc84af2e45c0fac0",
|
||||
"status": "accepted",
|
||||
"account": {
|
||||
"id": "01a7362d577a6c3019a474fd6f485823",
|
||||
"name": "Demo Account",
|
||||
"settings": {
|
||||
"enforce_twofactor": false
|
||||
}
|
||||
},
|
||||
"roles": [
|
||||
"Account Administrator"
|
||||
],
|
||||
"permissions": {
|
||||
"analytics": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"billing": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"cache_purge": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns_records": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"lb": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"logs": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"organization": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"ssl": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"waf": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zones": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zone_settings": {
|
||||
"read": true,
|
||||
"write": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/getOnionRoutingSetting.json
Normal file
6
tests/Fixtures/Endpoints/getOnionRoutingSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "opportunistic_encryption",
|
||||
"value": "off",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
28
tests/Fixtures/Endpoints/getPoolDetails.json
Normal file
28
tests/Fixtures/Endpoints/getPoolDetails.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Primary data center - Provider XYZ",
|
||||
"name": "primary-dc-1",
|
||||
"enabled": true,
|
||||
"minimum_origins": 2,
|
||||
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
|
||||
"check_regions": [
|
||||
"WEU",
|
||||
"ENAM"
|
||||
],
|
||||
"origins": [
|
||||
{
|
||||
"name": "app-server-1",
|
||||
"address": "0.0.0.0",
|
||||
"enabled": true,
|
||||
"weight": 0.56
|
||||
}
|
||||
],
|
||||
"notification_email": "someone@example.com"
|
||||
}
|
||||
}
|
||||
29
tests/Fixtures/Endpoints/getRecordId.json
Normal file
29
tests/Fixtures/Endpoints/getRecordId.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": [
|
||||
{
|
||||
"id": "372e67954025e0ba6aaa6d586b9e0b59",
|
||||
"type": "A",
|
||||
"name": "example.com",
|
||||
"content": "198.51.100.4",
|
||||
"proxiable": true,
|
||||
"proxied": false,
|
||||
"ttl": {},
|
||||
"locked": false,
|
||||
"zone_id": "023e105f4ecef8ad9ca31a8372d0c353",
|
||||
"zone_name": "example.com",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"data": {}
|
||||
}
|
||||
],
|
||||
"result_info": {
|
||||
"page": 1,
|
||||
"per_page": 20,
|
||||
"total_pages": 1,
|
||||
"count": 1,
|
||||
"total_count": 1
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/getSSLSetting.json
Normal file
11
tests/Fixtures/Endpoints/getSSLSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "ssl",
|
||||
"value": "off",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
16
tests/Fixtures/Endpoints/getSSLVerificationStatus.json
Normal file
16
tests/Fixtures/Endpoints/getSSLVerificationStatus.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"result": [
|
||||
{
|
||||
"certificate_status": "active",
|
||||
"verification_type": "cname",
|
||||
"verification_status": true,
|
||||
"verification_info": {
|
||||
"record_name": "b3b90cfedd89a3e487d3e383c56c4267.example.com",
|
||||
"record_target": "6979be7e4cfc9e5c603e31df7efac9cc60fee82d.comodoca.com"
|
||||
},
|
||||
"brand_check": false,
|
||||
"validation_method": "txt",
|
||||
"cert_pack_uuid": "a77f8bd7-3b47-46b4-a6f1-75cf98109948"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/getSecurityLevelSetting.json
Normal file
11
tests/Fixtures/Endpoints/getSecurityLevelSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "security_level",
|
||||
"value": "medium",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/getTLSClientAuth.json
Normal file
11
tests/Fixtures/Endpoints/getTLSClientAuth.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "tls_client_auth",
|
||||
"value": "off",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
59
tests/Fixtures/Endpoints/getZoneById.json
Normal file
59
tests/Fixtures/Endpoints/getZoneById.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "023e105f4ecef8ad9ca31a8372d0c353",
|
||||
"name": "example.com",
|
||||
"development_mode": 7200,
|
||||
"original_name_servers": [
|
||||
"ns1.originaldnshost.com",
|
||||
"ns2.originaldnshost.com"
|
||||
],
|
||||
"original_registrar": "GoDaddy",
|
||||
"original_dnshost": "NameCheap",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"activated_on": "2014-01-02T00:01:00.12345Z",
|
||||
"owner": {
|
||||
"id": "7c5dae5552338874e5053f2534d2767a",
|
||||
"email": "user@example.com",
|
||||
"type": "user"
|
||||
},
|
||||
"account": {
|
||||
"id": "01a7362d577a6c3019a474fd6f485823",
|
||||
"name": "Demo Account"
|
||||
},
|
||||
"permissions": [
|
||||
"#zone:read",
|
||||
"#zone:edit"
|
||||
],
|
||||
"plan": {
|
||||
"id": "e592fd9519420ba7405e1307bff33214",
|
||||
"name": "Pro Plan",
|
||||
"price": 20,
|
||||
"currency": "USD",
|
||||
"frequency": "monthly",
|
||||
"legacy_id": "pro",
|
||||
"is_subscribed": true,
|
||||
"can_subscribe": true
|
||||
},
|
||||
"plan_pending": {
|
||||
"id": "e592fd9519420ba7405e1307bff33214",
|
||||
"name": "Pro Plan",
|
||||
"price": 20,
|
||||
"currency": "USD",
|
||||
"frequency": "monthly",
|
||||
"legacy_id": "pro",
|
||||
"is_subscribed": true,
|
||||
"can_subscribe": true
|
||||
},
|
||||
"status": "active",
|
||||
"paused": false,
|
||||
"type": "full",
|
||||
"name_servers": [
|
||||
"tony.ns.cloudflare.com",
|
||||
"woz.ns.cloudflare.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
54
tests/Fixtures/Endpoints/listLoadBalancers.json
Normal file
54
tests/Fixtures/Endpoints/listLoadBalancers.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": [
|
||||
{
|
||||
"id": "699d98642c564d2e855e9661899b7252",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Load Balancer for www.example.com",
|
||||
"name": "www.example.com",
|
||||
"enabled": true,
|
||||
"ttl": 30,
|
||||
"fallback_pool": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"default_pools": [
|
||||
"17b5962d775c646f3f9725cbc7a53df4",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196",
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
],
|
||||
"region_pools": {
|
||||
"WNAM": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"ENAM": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"pop_pools": {
|
||||
"LAX": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"LHR": [
|
||||
"abd90f38ced07c2e2f4df50b1f61d4194",
|
||||
"f9138c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"SJC": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"proxied": true,
|
||||
"steering_policy": "dynamic_latency",
|
||||
"session_affinity": "cookie",
|
||||
"session_affinity_ttl": 5000
|
||||
}
|
||||
],
|
||||
"result_info": {
|
||||
"page": 1,
|
||||
"per_page": 20,
|
||||
"count": 1,
|
||||
"total_count": 2000
|
||||
}
|
||||
}
|
||||
78
tests/Fixtures/Endpoints/listMemberships.json
Normal file
78
tests/Fixtures/Endpoints/listMemberships.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": [
|
||||
{
|
||||
"id": "4536bcfad5faccb111b47003c79917fa",
|
||||
"code": "05dd05cce12bbed97c0d87cd78e89bc2fd41a6cee72f27f6fc84af2e45c0fac0",
|
||||
"status": "accepted",
|
||||
"account": {
|
||||
"id": "01a7362d577a6c3019a474fd6f485823",
|
||||
"name": "Demo Account",
|
||||
"settings": {
|
||||
"enforce_twofactor": false
|
||||
}
|
||||
},
|
||||
"roles": [
|
||||
"Account Administrator"
|
||||
],
|
||||
"permissions": {
|
||||
"analytics": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"billing": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"cache_purge": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns_records": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"lb": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"logs": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"organization": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"ssl": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"waf": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zones": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zone_settings": {
|
||||
"read": true,
|
||||
"write": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"result_info": {
|
||||
"page": 1,
|
||||
"per_page": 20,
|
||||
"count": 1,
|
||||
"total_count": 2000
|
||||
}
|
||||
}
|
||||
36
tests/Fixtures/Endpoints/listPools.json
Normal file
36
tests/Fixtures/Endpoints/listPools.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": [
|
||||
{
|
||||
"id": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Primary data center - Provider XYZ",
|
||||
"name": "primary-dc-1",
|
||||
"enabled": true,
|
||||
"minimum_origins": 2,
|
||||
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
|
||||
"check_regions": [
|
||||
"WEU",
|
||||
"ENAM"
|
||||
],
|
||||
"origins": [
|
||||
{
|
||||
"name": "app-server-1",
|
||||
"address": "0.0.0.0",
|
||||
"enabled": true,
|
||||
"weight": 0.56
|
||||
}
|
||||
],
|
||||
"notification_email": "someone@example.com"
|
||||
}
|
||||
],
|
||||
"result_info": {
|
||||
"page": 1,
|
||||
"per_page": 20,
|
||||
"count": 1,
|
||||
"total_count": 2000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "browser_check",
|
||||
"value": "on",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/updateChallengeTTLSetting.json
Normal file
11
tests/Fixtures/Endpoints/updateChallengeTTLSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "challenge_ttl",
|
||||
"value": 1800,
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/updateHTTPSRedirectSetting.json
Normal file
6
tests/Fixtures/Endpoints/updateHTTPSRedirectSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/updateHTTPSRewritesSetting.json
Normal file
6
tests/Fixtures/Endpoints/updateHTTPSRewritesSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
46
tests/Fixtures/Endpoints/updateLoadBalancer.json
Normal file
46
tests/Fixtures/Endpoints/updateLoadBalancer.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "699d98642c564d2e855e9661899b7252",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Load Balancer for www.example.com",
|
||||
"name": "www.example.com",
|
||||
"enabled": true,
|
||||
"ttl": 30,
|
||||
"fallback_pool": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"default_pools": [
|
||||
"17b5962d775c646f3f9725cbc7a53df4",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196",
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
],
|
||||
"region_pools": {
|
||||
"WNAM": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"ENAM": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"pop_pools": {
|
||||
"LAX": [
|
||||
"de90f38ced07c2e2f4df50b1f61d4194",
|
||||
"9290f38c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"LHR": [
|
||||
"abd90f38ced07c2e2f4df50b1f61d4194",
|
||||
"f9138c5d07c2e2f4df57b1f61d4196"
|
||||
],
|
||||
"SJC": [
|
||||
"00920f38ce07c2e2f4df50b1f61d4194"
|
||||
]
|
||||
},
|
||||
"proxied": true,
|
||||
"steering_policy": "dynamic_latency",
|
||||
"session_affinity": "cookie",
|
||||
"session_affinity_ttl": 5000
|
||||
}
|
||||
}
|
||||
70
tests/Fixtures/Endpoints/updateMembershipStatus.json
Normal file
70
tests/Fixtures/Endpoints/updateMembershipStatus.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "4536bcfad5faccb111b47003c79917fa",
|
||||
"code": "05dd05cce12bbed97c0d87cd78e89bc2fd41a6cee72f27f6fc84af2e45c0fac0",
|
||||
"status": "accepted",
|
||||
"account": {
|
||||
"id": "01a7362d577a6c3019a474fd6f485823",
|
||||
"name": "Demo Account",
|
||||
"settings": {
|
||||
"enforce_twofactor": false
|
||||
}
|
||||
},
|
||||
"roles": [
|
||||
"Account Administrator"
|
||||
],
|
||||
"permissions": {
|
||||
"analytics": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"billing": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"cache_purge": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"dns_records": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"lb": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"logs": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"organization": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"ssl": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"waf": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zones": {
|
||||
"read": true,
|
||||
"write": true
|
||||
},
|
||||
"zone_settings": {
|
||||
"read": true,
|
||||
"write": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
tests/Fixtures/Endpoints/updateOnionRoutingSetting.json
Normal file
6
tests/Fixtures/Endpoints/updateOnionRoutingSetting.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": "off"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "opportunistic_encryption",
|
||||
"value": "on",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
28
tests/Fixtures/Endpoints/updatePool.json
Normal file
28
tests/Fixtures/Endpoints/updatePool.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "17b5962d775c646f3f9725cbc7a53df4",
|
||||
"created_on": "2014-01-01T05:20:00.12345Z",
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z",
|
||||
"description": "Primary data center - Provider XYZ",
|
||||
"name": "primary-dc-1",
|
||||
"enabled": true,
|
||||
"minimum_origins": 2,
|
||||
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
|
||||
"check_regions": [
|
||||
"WEU",
|
||||
"ENAM"
|
||||
],
|
||||
"origins": [
|
||||
{
|
||||
"name": "app-server-1",
|
||||
"address": "0.0.0.0",
|
||||
"enabled": true,
|
||||
"weight": 0.56
|
||||
}
|
||||
],
|
||||
"notification_email": "someone@example.com"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"validation_method": "txt",
|
||||
"status": "pending_validation"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/updateSSLSetting.json
Normal file
11
tests/Fixtures/Endpoints/updateSSLSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "ssl",
|
||||
"value": "off",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/updateSecurityLevelSetting.json
Normal file
11
tests/Fixtures/Endpoints/updateSecurityLevelSetting.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "security_level",
|
||||
"value": "medium",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Endpoints/updateTLSClientAuth.json
Normal file
11
tests/Fixtures/Endpoints/updateTLSClientAuth.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": true,
|
||||
"errors": [],
|
||||
"messages": [],
|
||||
"result": {
|
||||
"id": "tls_client_auth",
|
||||
"value": "off",
|
||||
"editable": true,
|
||||
"modified_on": "2014-01-01T05:20:00.12345Z"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user