From 8a60243d0d44d14edda43443d0546d35dc6f2788 Mon Sep 17 00:00:00 2001 From: Fernando Prado Date: Thu, 17 Oct 2024 18:14:38 +0200 Subject: [PATCH 1/3] include changes --- code/Test_definitions/check-sim-swap.feature | 46 +++++++++++-------- .../retrieve-sim-swap-date.feature | 23 +++------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/code/Test_definitions/check-sim-swap.feature b/code/Test_definitions/check-sim-swap.feature index 399b6d1..b1dfa56 100644 --- a/code/Test_definitions/check-sim-swap.feature +++ b/code/Test_definitions/check-sim-swap.feature @@ -18,7 +18,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap # This first scenario serves as a minimum, not testing any specific verificationResult @check_sim_swap_1_generic_success_scenario Scenario: Common validations for any sucess scenario - Given the request header "Authorization" is set to a valid access token from which a valid testing phoneNumber can be deducted + Given a valid phone number identified by the token or provided in the request body When the request "checkSimSwap" is sent Then the response status code is 200 And the response header "Content-Type" is "application/json" @@ -29,7 +29,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap @check_sim_swap_2_valid_sim_swap_no_max_age Scenario: Check that the response shows that the SIM has been swapped using default value for maxAge - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has been swapped in the last 240 hours When the request "checkSimSwap" is sent Then the response status code is 200 @@ -37,7 +37,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap @check_sim_swap_3_valid_sim_swap_max_age Scenario Outline: Check that the response shows that the SIM has been swapped - maxAge is provided in the request - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has been swapped in the last "" And the "maxAge" request body property is set to a value equal or greater than "" within the allowed range When the request "checkSimSwap" is sent @@ -53,7 +53,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap @check_sim_swap_4_more_than_240_hours Scenario: Check that the response shows that the SIM has not been swapped when the last swap was more than 240 hours ago - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has been swapped more than 240 hours ago When the request "checkSimSwap" is sent Then the response status code is 200 @@ -61,24 +61,40 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap @check_sim_swap_5_out_of_max_age Scenario: Check that the response shows that the SIM has not been swapped when the last swap was before the maxAge field - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the request body property "maxAge" is set to the number of hours since the last SIM swap minus 1 And the last swap for this phone number's SIM was more than "maxAge" hours ago When the request "checkSimSwap" is sent Then the response status code is 200 And the value of response property "$.swapped" == false - @check_sim_swap_6_no_sim_swap - Scenario: Check that the response shows that the SIM has not been swapped - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + @check_sim_swap_6_no_sim_swap_no_max_age + Scenario: Check that the response shows that the SIM has not been swapped - maxAge is not provided in the request parameter + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has never been swapped When the request "checkSimSwap" is sent Then the response status code is 200 And the value of response property "$.swapped" == false + @check_sim_swap_7_no_sim_swap_with_max_age + Scenario Outline: Check that the response shows that the SIM has not been swapped - maxAge is provided in the request parameter + Given a valid phone number identified by the token or provided in the request body + And the SIM for this phone number has never been swapped + And the request body property "maxAge" is set to a value equal or greater than "" within the allowed range + When the request "checkSimSwap" is sent + Then the response status code is 200 + And the value of response property "$.swapped" == false + + Examples: + | hours | + | 260 | + | 120 | + | 24 | + | 12 | + # Specific errors - @check_sim_swap_7_phone_number_not_supported + @check_sim_swap_8_phone_number_not_supported Scenario: Error when the service is not supported for the provided phone number Given the request body property "$.phoneNumber" is set to a phone number for which the service is not available When the request "checkSimSwap" is sent @@ -87,7 +103,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap And the response property "$.code" is "NOT_SUPPORTED" And the response property "$.message" contains a user friendly text - @check_sim_swap_8_phone_number_provided_does_not_match_the_token + @check_sim_swap_9_phone_number_provided_does_not_match_the_token Scenario: Error when the phone number provided in the request body does not match the phone number asssociated with the access token Given the request body property "$.phoneNumber" is set to a valid testing phoneNumber that does not match the one associated with the token And the header "Authorization" is set to a valid access token @@ -97,16 +113,6 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap And the response property "$.code" is "INVALID_TOKEN_CONTEXT" And the response property "$.message" contains a user friendly text - @check_sim_swap_9_phone_number_provided_cannot_be_deducted_from_access_token - Scenario: Error when the phone number is provided in the request body but cannot be deducted from the access token - Given the request body property "$.phoneNumber" is set to a valid testing phoneNumber of the user - And the header "Authorization" is set to a valid access token from which the phone number cannot be deducted - When the request "checkSimSwap" is sent - Then the response status code is 403 - And the response property "$.status" is 403 - And the response property "$.code" is "INVALID_TOKEN_CONTEXT" - And the response property "$.message" contains a user friendly text - @check_sim_swap_10_phone_number_not_provided_and_cannot_be_deducted_from_access_token Scenario: Error when phone number can not be deducted from access token and it is not provided in the request body Given the header "Authorization" is set to a valid access token from which the phone number cannot be deducted diff --git a/code/Test_definitions/retrieve-sim-swap-date.feature b/code/Test_definitions/retrieve-sim-swap-date.feature index 7fd57c5..d10cbf9 100644 --- a/code/Test_definitions/retrieve-sim-swap-date.feature +++ b/code/Test_definitions/retrieve-sim-swap-date.feature @@ -18,7 +18,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate # This first scenario serves as a minimum, not testing any specific verificationResult @retrieve_sim_swap_date_1_generic_success_scenario Scenario: Common validations for any sucess scenario - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body When the request "retrieveSimSwapDate" is sent Then the response status code is 200 And the response header "Content-Type" is "application/json" @@ -29,7 +29,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate @retrieve_sim_swap_date_2_valid_sim_swap Scenario: Retrieve SIM swap date for a valid SIM swap - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has been swapped When the request "retrieveSimSwapDate" is sent Then the response status code is 200 @@ -38,7 +38,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate # This scenario applies for operators which do not limit the "monitoring history" @retrieve_sim_swap_date_3_no_sim_swap_returns_activation_date Scenario: Response contains the sim's activation date when it hasn't been swapped - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has never been swapped When the request "retrieveSimSwapDate" is sent Then the response status code is 200 @@ -47,7 +47,8 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate # This test applies if the operator allows to do the request for a sim that has never been connected to the network @retrieve_sim_swap_date_4_sim_not_activated Scenario: Retrieves SIM swap date for a non-activated sim - Given the request header "Authorization" is set to a valid access token from which a phone number never connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body + And the sim for that device has never been connected to the Operator's network When the request "retrieveSimSwapDate" is sent Then the response status code is 200 And the response property "$.latestSimChange" is null @@ -55,7 +56,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate # This scenario applies when there is a local regulation with a time limitation on the information that can be returned @retrieve_sim_swap_date_5_no_sim_swap_or_activation_date_due_to_legal_constrain Scenario: Retrieves SIM swap date for a valid SIM swap - Given the request header "Authorization" is set to a valid access token from which a phone number connected to the Operator's network can be deducted + Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has been swapped before the limited history window threshold When the request "retrieveSimSwapDate" is sent Then the response status code is 200 @@ -82,17 +83,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation retrieveSimSwapDate And the response property "$.code" is "INVALID_TOKEN_CONTEXT" And the response property "$.message" contains a user friendly text - @retrieve_sim_swap_date_8_phone_number_provided_cannot_be_deducted_from_access_token - Scenario: Error when the phone number is provided in the request body but cannot be deducted from the access token - Given the request body property "$.phoneNumber" is set to a valid testing phoneNumber of the user - And the header "Authorization" is set to a valid access token from which the phone number cannot be deducted - When the request "retrieveSimSwapDate" is sent - Then the response status code is 403 - And the response property "$.status" is 403 - And the response property "$.code" is "INVALID_TOKEN_CONTEXT" - And the response property "$.message" contains a user friendly text - - @retrieve_sim_swap_date_9_phone_number_not_provided_and_cannot_be_deducted_from_access_token + @retrieve_sim_swap_date_8_phone_number_not_provided_and_cannot_be_deducted_from_access_token Scenario: Error when phone number can not be deducted from access token and it is not provided in the request body Given the header "Authorization" is set to a valid access token from which the phone number cannot be deducted When the request "retrieveSimSwapDate" is sent From db77cee3ad3677f7efe849c55e5b82a9ee1aaba1 Mon Sep 17 00:00:00 2001 From: Fernando Prado Date: Thu, 17 Oct 2024 18:16:44 +0200 Subject: [PATCH 2/3] rename feature files --- .../{check-sim-swap.feature => sim-swap-check.feature} | 0 ...trieve-sim-swap-date.feature => sim-swap-retrieveDate.feature} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename code/Test_definitions/{check-sim-swap.feature => sim-swap-check.feature} (100%) rename code/Test_definitions/{retrieve-sim-swap-date.feature => sim-swap-retrieveDate.feature} (100%) diff --git a/code/Test_definitions/check-sim-swap.feature b/code/Test_definitions/sim-swap-check.feature similarity index 100% rename from code/Test_definitions/check-sim-swap.feature rename to code/Test_definitions/sim-swap-check.feature diff --git a/code/Test_definitions/retrieve-sim-swap-date.feature b/code/Test_definitions/sim-swap-retrieveDate.feature similarity index 100% rename from code/Test_definitions/retrieve-sim-swap-date.feature rename to code/Test_definitions/sim-swap-retrieveDate.feature From 8a5f02ad6fd9e665f19382ce1dbcc07bc4e4b79a Mon Sep 17 00:00:00 2001 From: Fernando Prado Date: Fri, 18 Oct 2024 12:54:02 +0200 Subject: [PATCH 3/3] fix scenarios --- code/Test_definitions/sim-swap-check.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/Test_definitions/sim-swap-check.feature b/code/Test_definitions/sim-swap-check.feature index b1dfa56..121ede6 100644 --- a/code/Test_definitions/sim-swap-check.feature +++ b/code/Test_definitions/sim-swap-check.feature @@ -72,6 +72,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap Scenario: Check that the response shows that the SIM has not been swapped - maxAge is not provided in the request parameter Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has never been swapped + And the activation of the SIM occurred more than 240 hours ago When the request "checkSimSwap" is sent Then the response status code is 200 And the value of response property "$.swapped" == false @@ -80,6 +81,7 @@ Feature: CAMARA SIM Swap API, 1.0.0 - Operation checkSimSwap Scenario Outline: Check that the response shows that the SIM has not been swapped - maxAge is provided in the request parameter Given a valid phone number identified by the token or provided in the request body And the SIM for this phone number has never been swapped + And the activation of the SIM occurred more than "" hours ago And the request body property "maxAge" is set to a value equal or greater than "" within the allowed range When the request "checkSimSwap" is sent Then the response status code is 200