summaryrefslogtreecommitdiffstats
path: root/Twilio/Tests/Integration/Notify/V1/CredentialTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'Twilio/Tests/Integration/Notify/V1/CredentialTest.php')
-rw-r--r--Twilio/Tests/Integration/Notify/V1/CredentialTest.php230
1 files changed, 230 insertions, 0 deletions
diff --git a/Twilio/Tests/Integration/Notify/V1/CredentialTest.php b/Twilio/Tests/Integration/Notify/V1/CredentialTest.php
new file mode 100644
index 0000000..88c0b50
--- /dev/null
+++ b/Twilio/Tests/Integration/Notify/V1/CredentialTest.php
@@ -0,0 +1,230 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Tests\Integration\Notify\V1;
+
+use Twilio\Exceptions\DeserializeException;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Http\Response;
+use Twilio\Tests\HolodeckTestCase;
+use Twilio\Tests\Request;
+
+class CredentialTest extends HolodeckTestCase {
+ public function testReadRequest() {
+ $this->holodeck->mock(new Response(500, ''));
+
+ try {
+ $this->twilio->notify->v1->credentials->read();
+ } catch (DeserializeException $e) {}
+ catch (TwilioException $e) {}
+
+ $this->assertTrue($this->holodeck->hasRequest(new Request(
+ 'get',
+ 'https://notify.twilio.com/v1/Credentials'
+ )));
+ }
+
+ public function testReadFullResponse() {
+ $this->holodeck->mock(new Response(
+ 200,
+ '
+ {
+ "credentials": [
+ {
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "friendly_name": "Test slow create",
+ "type": "apn",
+ "sandbox": "False",
+ "date_created": "2015-10-07T17:50:01Z",
+ "date_updated": "2015-10-07T17:50:01Z",
+ "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ }
+ ],
+ "meta": {
+ "page": 0,
+ "page_size": 1,
+ "first_page_url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0",
+ "previous_page_url": null,
+ "url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0",
+ "next_page_url": null,
+ "key": "credentials"
+ }
+ }
+ '
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials->read();
+
+ $this->assertTrue(count($actual) > 0);
+ }
+
+ public function testReadEmptyResponse() {
+ $this->holodeck->mock(new Response(
+ 200,
+ '
+ {
+ "credentials": [],
+ "meta": {
+ "page": 0,
+ "page_size": 1,
+ "first_page_url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0",
+ "previous_page_url": null,
+ "url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0",
+ "next_page_url": null,
+ "key": "credentials"
+ }
+ }
+ '
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials->read();
+
+ $this->assertNotNull($actual);
+ }
+
+ public function testCreateRequest() {
+ $this->holodeck->mock(new Response(500, ''));
+
+ try {
+ $this->twilio->notify->v1->credentials->create("gcm");
+ } catch (DeserializeException $e) {}
+ catch (TwilioException $e) {}
+
+ $values = array(
+ 'Type' => "gcm",
+ );
+
+ $this->assertTrue($this->holodeck->hasRequest(new Request(
+ 'post',
+ 'https://notify.twilio.com/v1/Credentials',
+ null,
+ $values
+ )));
+ }
+
+ public function testCreateResponse() {
+ $this->holodeck->mock(new Response(
+ 201,
+ '
+ {
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "friendly_name": "Test slow create",
+ "type": "apn",
+ "sandbox": "False",
+ "date_created": "2015-10-07T17:50:01Z",
+ "date_updated": "2015-10-07T17:50:01Z",
+ "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ }
+ '
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials->create("gcm");
+
+ $this->assertNotNull($actual);
+ }
+
+ public function testFetchRequest() {
+ $this->holodeck->mock(new Response(500, ''));
+
+ try {
+ $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch();
+ } catch (DeserializeException $e) {}
+ catch (TwilioException $e) {}
+
+ $this->assertTrue($this->holodeck->hasRequest(new Request(
+ 'get',
+ 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ )));
+ }
+
+ public function testFetchResponse() {
+ $this->holodeck->mock(new Response(
+ 200,
+ '
+ {
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "friendly_name": "Test slow create",
+ "type": "apn",
+ "sandbox": "False",
+ "date_created": "2015-10-07T17:50:01Z",
+ "date_updated": "2015-10-07T17:50:01Z",
+ "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ }
+ '
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch();
+
+ $this->assertNotNull($actual);
+ }
+
+ public function testUpdateRequest() {
+ $this->holodeck->mock(new Response(500, ''));
+
+ try {
+ $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update();
+ } catch (DeserializeException $e) {}
+ catch (TwilioException $e) {}
+
+ $this->assertTrue($this->holodeck->hasRequest(new Request(
+ 'post',
+ 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ )));
+ }
+
+ public function testUpdateResponse() {
+ $this->holodeck->mock(new Response(
+ 200,
+ '
+ {
+ "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "friendly_name": "Test slow create",
+ "type": "apn",
+ "sandbox": "False",
+ "date_created": "2015-10-07T17:50:01Z",
+ "date_updated": "2015-10-07T17:50:01Z",
+ "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ }
+ '
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update();
+
+ $this->assertNotNull($actual);
+ }
+
+ public function testDeleteRequest() {
+ $this->holodeck->mock(new Response(500, ''));
+
+ try {
+ $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete();
+ } catch (DeserializeException $e) {}
+ catch (TwilioException $e) {}
+
+ $this->assertTrue($this->holodeck->hasRequest(new Request(
+ 'delete',
+ 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ )));
+ }
+
+ public function testDeleteResponse() {
+ $this->holodeck->mock(new Response(
+ 204,
+ null
+ ));
+
+ $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete();
+
+ $this->assertTrue($actual);
+ }
+} \ No newline at end of file