adapter_broadcast.feature 2.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Feature: Can the adapter broadcast messages?
  The adapter publish method works as expected

  Scenario: A message can be published successfully
    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 success
    When the broadcast method is called
    Then a successful response is returned with status 200

  Scenario: A failed publish returns a 403
    Given valid config
    When the adapter instance is created
    When the auth method is called
Dan Jones's avatar
Dan Jones committed
16
    When a mock notify API response is configured to return a 403 error
17
    When the broadcast method is called
18 19 20 21 22 23
    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 
24
    When a mock notify API response is configured to return a 403 error
25 26 27 28
    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
29 30
    Then the total number of calls to "broadcast" was 2
    Then the total number of calls to "getAuthorizationHeader" was 2
31 32 33 34 35
    
  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 
Dan Jones's avatar
Dan Jones committed
36
    When a mock notify API response is configured to return a 403 error 
37 38 39
    When the broadcast method is called with is_retry on
    Then an error response is returned with status 403
    Then the credentials are deleted 
40 41
    Then the total number of calls to "broadcast" was 1
    
Dan Jones's avatar
Dan Jones committed
42 43 44 45 46 47 48 49 50
  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
51 52
    Then the total number of calls to "broadcast" was 2
    Then the total number of calls to "getAuthorizationHeader" was 1
Dan Jones's avatar
Dan Jones committed
53 54 55 56 57 58 59 60 61
    
  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 
62
    Then the total number of calls to "broadcast" was 1