From d75d34e952c5a842587b5c4f5862c5a187d12e71 Mon Sep 17 00:00:00 2001
From: Dan Jones <dan.jones@noc.ac.uk>
Date: Mon, 20 Feb 2023 12:42:49 +0000
Subject: [PATCH] feat: add tests for publish retry on 403

---
 features/adapter_publish.feature | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/features/adapter_publish.feature b/features/adapter_publish.feature
index 7e7e7de..e3429c6 100644
--- a/features/adapter_publish.feature
+++ b/features/adapter_publish.feature
@@ -16,3 +16,24 @@ Feature: Can the adapter publish messages?
     When a mock send API response is configured to return an 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 an 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 is 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 an 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
-- 
GitLab