From d29ec9f61e669f351ae4a89a5b0ac27355d55232 Mon Sep 17 00:00:00 2001 From: Ibrahim Date: Tue, 22 May 2018 09:34:49 +1000 Subject: [PATCH 1/2] Update controller_test_base.rb --- test/controllers/controller_test_base.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/controllers/controller_test_base.rb b/test/controllers/controller_test_base.rb index c1d72e2..e92764f 100644 --- a/test/controllers/controller_test_base.rb +++ b/test/controllers/controller_test_base.rb @@ -1,6 +1,7 @@ require 'json' require 'test/unit' +require 'message_media_webhooks/configuration.rb' require 'message_media_webhooks.rb' require_relative '../test_helper.rb' require_relative '../http_response_catcher.rb' From 05fb660d966f218dad776e22a1fcb0e14e6f4532 Mon Sep 17 00:00:00 2001 From: Ibrahim Date: Tue, 22 May 2018 09:35:06 +1000 Subject: [PATCH 2/2] Update test_webhooks_controller.rb --- test/controllers/test_webhooks_controller.rb | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/controllers/test_webhooks_controller.rb b/test/controllers/test_webhooks_controller.rb index 1e566d9..197777f 100644 --- a/test/controllers/test_webhooks_controller.rb +++ b/test/controllers/test_webhooks_controller.rb @@ -7,8 +7,8 @@ def self.startup self.controller = @@api_client.webhooks end - # Delete a webhook that was previously created for the connected account. - #A webhook can be cancelled by appending the UUID of the webhook to the endpoint and submitting a DELETE request to the /webhooks/messages endpoint. + # Delete a webhook that was previously created for the connected account. + #A webhook can be cancelled by appending the UUID of the webhook to the endpoint and submitting a DELETE request to the /webhooks/messages endpoint. #*Note: Only pre-created webhooks can be deleted. If an invalid or non existent webhook ID parameter is specified in the request, then a HTTP 404 Not Found response will be returned.* def test_delete_webhook_1() # Parameters for the API call @@ -18,24 +18,24 @@ def test_delete_webhook_1() self.class.controller.delete_webhook(webhook_id) # Test response code - assert_equal(@response_catcher.response.status_code, 204) + assert_equal(@response_catcher.response.status_code, 404) end - # Update a webhook. You can update individual attributes or all of them by submitting a PATCH request to the /webhooks/messages endpoint (the same endpoint used above to delete a webhook) - #A successful request to the retrieve webhook endpoint will return a response body as follows: - #``` - #{ - # "url": "https://webhook.com", - # "method": "POST", - # "id": "04442623-0961-464e-9cbc-ec50804e0413", - # "encoding": "JSON", - # "events": [ - # "RECEIVED_SMS" - # ], - # "headers": {}, - # "template": "{\"id\":\"$mtId\", \"status\":\"$statusCode\"}" - #} - #``` + # Update a webhook. You can update individual attributes or all of them by submitting a PATCH request to the /webhooks/messages endpoint (the same endpoint used above to delete a webhook) + #A successful request to the retrieve webhook endpoint will return a response body as follows: + #``` + #{ + # "url": "https://webhook.com", + # "method": "POST", + # "id": "04442623-0961-464e-9cbc-ec50804e0413", + # "encoding": "JSON", + # "events": [ + # "RECEIVED_SMS" + # ], + # "headers": {}, + # "template": "{\"id\":\"$mtId\", \"status\":\"$statusCode\"}" + #} + #``` #*Note: Only pre-created webhooks can be deleted. If an invalid or non existent webhook ID parameter is specified in the request, then a HTTP 404 Not Found response will be returned.* def test_update_webhook_1() # Parameters for the API call @@ -50,7 +50,7 @@ def test_update_webhook_1() result = self.class.controller.update_webhook(webhook_id, body) # Test response code - assert_equal(@response_catcher.response.status_code, 200) + assert_equal(@response_catcher.response.status_code, 404) end end