diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-15 09:04:40 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2015-12-15 09:04:40 -0800 |
commit | ebf68af9d4158450b6d673bf6d31ff5297057882 (patch) | |
tree | 070960b03eeba9d367bf5b22d6c055f78d24abf4 /test/unit/resources/api_keysTest.php | |
parent | 6f46520a1ecbd5e81562d67dadb75741e50e408b (diff) | |
download | sendgrid-php-4.0.2.zip sendgrid-php-4.0.2.tar.gz sendgrid-php-4.0.2.tar.bz2 |
Version Bump 4.0.2v4.0.2
Diffstat (limited to 'test/unit/resources/api_keysTest.php')
-rw-r--r-- | test/unit/resources/api_keysTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/unit/resources/api_keysTest.php b/test/unit/resources/api_keysTest.php index 8045d4c..72ecff9 100644 --- a/test/unit/resources/api_keysTest.php +++ b/test/unit/resources/api_keysTest.php @@ -13,4 +13,50 @@ class SendGridTest_APIKeys extends baseTest $this->assertEquals($code, $response->getStatusCode()); $this->assertEquals($body, $response->getBody()); } + + public function testPOST() + { + $code = 200; + $headers = array('Content-Type' => 'application/json'); + $body = '{ + "api_key": "SG.xxxxxxxx.yyyyyyyy", + "api_key_id": "xxxxxxxx", + "name": "My API Key", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ] + }'; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->post("My API Key"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + + public function testPATCH() + { + $code = 200; + $headers = array('Content-Type' => 'application/json'); + $body = '{ + "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", + "name": "A New Hope" + }'; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->patch("qfTQ6KG0QBiwWdJ0-pCLCA", "Magic Key Updated"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + + public function testDELETE() + { + $code = 204; + $headers = ''; + $body = ''; + $sendgrid = $this->buildClient($code, $headers, $body); + $response = $sendgrid->api_keys->delete("qfTQ6KG0QBiwWdJ0-pCLCA"); + $this->assertEquals($code, $response->getStatusCode()); + $this->assertEquals($body, $response->getBody()); + } + }
\ No newline at end of file |