Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/controllers/controller_test_base.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
38 changes: 19 additions & 19 deletions test/controllers/test_webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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