Feature: Can the adapter publish 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 send API response is configured to return success
    When the publish 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
    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 getAuthorizationHeader method is called 
    
  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 publish method is not called again
  
  Scenario: On 503 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 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 getAuthorizationHeader method is not called again 
    
  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 publish method is not called again