From 1fd8622a217eda84f05c91a9a7181d5cfad0aace Mon Sep 17 00:00:00 2001
From: Dan Jones <dan.jones@noc.ac.uk>
Date: Tue, 21 Feb 2023 09:05:25 +0000
Subject: [PATCH] fix: count api calls to /token

getAuthorizationHeader is called again but only
requests a new token if a valid one is not available
---
 features/adapter_broadcast.feature | 4 ++--
 features/adapter_poll.feature      | 6 +++---
 features/adapter_publish.feature   | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/features/adapter_broadcast.feature b/features/adapter_broadcast.feature
index 5672212..9440f93 100644
--- a/features/adapter_broadcast.feature
+++ b/features/adapter_broadcast.feature
@@ -27,7 +27,7 @@ Feature: Can the adapter broadcast messages?
     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 calls to "getAuthorizationHeader" 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 
@@ -49,7 +49,7 @@ Feature: Can the adapter broadcast messages?
     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 calls to "getAuthorizationHeader" was 1
+    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 
diff --git a/features/adapter_poll.feature b/features/adapter_poll.feature
index bef9538..a30ea04 100644
--- a/features/adapter_poll.feature
+++ b/features/adapter_poll.feature
@@ -51,7 +51,7 @@ Feature: Can the adapter receive messages?
     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 calls to "getAuthorizationHeader" was 1
+    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 
@@ -73,8 +73,8 @@ Feature: Can the adapter receive messages?
     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 calls to "getAuthorizationHeader" was 1
-    
+    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 
diff --git a/features/adapter_publish.feature b/features/adapter_publish.feature
index 6675b4e..5e626bf 100644
--- a/features/adapter_publish.feature
+++ b/features/adapter_publish.feature
@@ -27,7 +27,7 @@ Feature: Can the adapter publish messages?
     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 calls to "getAuthorizationHeader" 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 
@@ -49,7 +49,7 @@ Feature: Can the adapter publish messages?
     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 calls to "getAuthorizationHeader" was 1
+    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 
-- 
GitLab