diff options
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 |