Commit 3a5b94e1 authored by Dan Jones's avatar Dan Jones
Browse files

Merge branch '9-error-handling-on-send' into 'dev'

Resolve "Error handling on send"

Closes #9

See merge request !3
parents 2a22ae98 09029c59
import os
from shutil import copytree
from shutil import copytree, rmtree
import site
def copy_directory(src, dest, directory):
rmtree(os.path.join(dest, directory))
copytree(os.path.join(src, directory), os.path.join(dest, directory))
......
......@@ -13,6 +13,50 @@ Feature: Can the adapter broadcast messages?
Given valid config
When the adapter instance is created
When the auth method is called
When a mock notify API response is configured to return an error
When a mock notify API response is configured to return a 403 error
When the broadcast method is called
Then an error response is returned with status 403
\ No newline at end of file
Then an error response is returned with status 403
Scenario: On 403 the message is retried once with new credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock notify API response is configured to return a 403 error
When the broadcast method is called
Then an error response is returned with status 403
Then the credentials are deleted
Then the broadcast method was called with is_retry on
Then the total number of calls to "broadcast" was 2
Then the total number of "GET" requests to "/token" was 2
Scenario: On a retried 403 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock notify API response is configured to return a 403 error
When the broadcast method is called with is_retry on
Then an error response is returned with status 403
Then the credentials are deleted
Then the total number of calls to "broadcast" was 1
Scenario: On 503 the message is retried once with the same credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock notify API response is configured to return a 503 error
When the broadcast method is called
Then an error response is returned with status 503
Then the credentials are not deleted
Then the broadcast method was called with is_retry on
Then the total number of calls to "broadcast" was 2
Then the total number of "GET" requests to "/token" was 1
Scenario: On a retried 503 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock notify API response is configured to return a 503 error
When the broadcast method is called with is_retry on
Then an error response is returned with status 503
Then the credentials are not deleted
Then the total number of calls to "broadcast" was 1
......@@ -37,6 +37,51 @@ Feature: Can the adapter receive messages?
Given valid config
When the adapter instance is created
When the auth method is called
When a mock receive API response is configured to return an error
When a mock receive API response is configured to return a 403 error
When the poll method is called
Then an error response is returned with status 403
Scenario: On 403 the message is retried once with new credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock receive API response is configured to return a 403 error
When the poll method is called
Then an error response is returned with status 403
Then the credentials are deleted
Then the poll method was called with is_retry on
Then the total number of calls to "poll" was 2
Then the total number of "GET" requests to "/token" was 2
Scenario: On a retried 403 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock receive API response is configured to return a 403 error
When the poll method is called with is_retry on
Then an error response is returned with status 403
Then the credentials are deleted
Then the total number of calls to "poll" was 1
Scenario: On 503 the message is retried once with the same credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock receive API response is configured to return a 503 error
When the poll method is called
Then an error response is returned with status 503
Then the credentials are not deleted
Then the poll method was called with is_retry on
Then the total number of calls to "poll" was 2
Then the total number of "GET" requests to "/token" was 1
Scenario: On a retried 503 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock receive API response is configured to return a 503 error
When the poll method is called with is_retry on
Then an error response is returned with status 503
Then the credentials are not deleted
Then the total number of calls to "poll" was 1
\ No newline at end of file
......@@ -13,6 +13,51 @@ Feature: Can the adapter publish messages?
Given valid config
When the adapter instance is created
When the auth method is called
When a mock send API response is configured to return an error
When a mock send API response is configured to return a 403 error
When the publish method is called
Then an error response is returned with status 403
Scenario: On 403 the message is retried once with new credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock send API response is configured to return a 403 error
When the publish method is called
Then an error response is returned with status 403
Then the credentials are deleted
Then the publish method was called with is_retry on
Then the total number of calls to "publish" was 2
Then the total number of "GET" requests to "/token" was 2
Scenario: On a retried 403 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock send API response is configured to return a 403 error
When the publish method is called with is_retry on
Then an error response is returned with status 403
Then the credentials are deleted
Then the total number of calls to "publish" was 1
Scenario: On 503 the message is retried once with the same credentials
Given valid config
When the adapter instance is created
When the auth method is called
When a mock send API response is configured to return a 503 error
When the publish method is called
Then an error response is returned with status 503
Then the credentials are not deleted
Then the publish method was called with is_retry on
Then the total number of calls to "publish" was 2
Then the total number of "GET" requests to "/token" was 1
Scenario: On a retried 503 the message is not retried again
Given valid config
When the adapter instance is created
When the auth method is called
When a mock send API response is configured to return a 503 error
When the publish method is called with is_retry on
Then an error response is returned with status 503
Then the credentials are not deleted
Then the total number of calls to "publish" was 1
\ No newline at end of file
{
"api": "https://example.backbone.com/api",
"api": "https://example.backbone.fake/api",
"client_id": "invalid-client-id",
"client_name": "InvalidClientName",
"subscription": "dot.delimited.topic.subscription.#",
......
{
"api": "https://example.backbone.com/api",
"api": "https://example.backbone.fake/api",
"client_id": "unique-client-id",
"client_name": "UniqueClientName",
"subscription": "dot.delimited.topic.subscription.#",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment