Skip to content

Commit 543553a

Browse files
feat(test): FTRS-18830 FTRS-1883 Adding in smoke tests
1 parent 8b7716d commit 543553a

File tree

7 files changed

+15
-25
lines changed

7 files changed

+15
-25
lines changed

tests/service_automation/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def env() -> str:
232232

233233

234234
@pytest.fixture(scope="module")
235-
def apigee_token() -> str:
236-
return _get_env_var("APIGEE_ACCESS_TOKEN")
235+
def apim_token() -> str:
236+
return _get_env_var("APIM_ACCESS_TOKEN")
237237

238238

239239
@pytest.fixture(scope="session", autouse=True)

tests/service_automation/tests/features/is_api_features/dos_search_apim_headers.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
@is-apim @integrated-search @dos-search-ods-code-api
22
@nhsd_apim_authorization(access="application",level="level3")
33
Feature: API DoS Service validates headers
4+
# Add tests to check that the headers are not case sensitive
5+
# Add tests to check for valid and invalid headers combos are handled correctly
6+
# Add tests that allowed headers are allowed 0 check for differences between apim and apig
7+
8+
9+
410

511
Background: Set stack and seed repo
612
Given that the stack is "dos-search"

tests/service_automation/tests/features/is_api_features/dos_search_apim_security.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: API DoS Service Search Is Secured
77
And I have a organisation repo
88
And I create a model in the repo from json file "Organisation/organisation-with-4-endpoints.json"
99

10-
10+
@test
1111
Scenario: I can access APIM for the 'ping' Endpoint and no access is required
1212
When I request data from the APIM endpoint "_ping" with query params "" without authentication
1313
Then I receive a status code "200" in response

tests/service_automation/tests/features/is_api_features/dos_search_smoke_tests.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Background: Set stack and select ODS code for testing from the organisation dyna
1515
And the response is valid against the dos-search schema for endpoint "/Organization"
1616

1717

18-
Scenario: I can access APIM for the dos-search'ping' Endpoint and no access is required
18+
Scenario: I can access APIM for the dos-search 'ping' Endpoint and no access is required
1919
When I request data from the APIM endpoint "_ping" with an odscode from dynamo organisation table but without authentication
2020
Then I receive a status code "200" in response
2121

22-
@test
22+
#DOn't think that the starus endpoint is accessible by a enduser
2323
Scenario: I can access APIM for the dos-search 'status' Endpoint and access is required
2424
When I request data from the APIM endpoint "_status" with an odscode from dynamo organisation table and with status token
2525
Then I receive a status code "200" in response

tests/service_automation/tests/step_definitions/common_steps/api_steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
@then(parsers.parse('I receive a status code "{status_code:d}" in response'))
99
def status_code(fresponse, status_code):
10-
logger.info(f"Received status code: {fresponse.json()}")
10+
# logger.info(f"Received status code: {fresponse.json()}")
1111
assert fresponse.status == status_code
1212

1313

tests/service_automation/tests/step_definitions/is_api_steps/dos_search_response_steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def api_check_resource_type_boolean_value(
8484
"""Verify {resource_type}.{field_name} has the expected boolean value.
8585
Accepts 'true' or 'false' (case-insensitive).
8686
"""
87-
expected_bool = expected_value.lower() == "true"
87+
expected_bool = expected_value == "true"
8888
response = fresponse.json()
8989
resource_entries = [
9090
e

tests/service_automation/tests/step_definitions/is_api_steps/test_dos_search_api.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,6 @@ def send_to_apim_invalid_token_with_ods_code(
218218
return _send_api_request(api_request_context, url, params, headers)
219219

220220

221-
@when(
222-
parsers.re(
223-
r'I request data from the APIM endpoint "(?P<resource_name>.*?)" with an odscode from dynamo organisation table and with status token'
224-
),
225-
target_fixture="fresponse",
226-
)
227-
def send_to_apim_status_token(
228-
apim_request_context,
229-
status_endpoint_auth_headers,
230-
dos_search_service_url,
231-
resource_name,
232-
):
233-
url = dos_search_service_url + "/" + resource_name
234-
return _send_api_request(apim_request_context, url, status_endpoint_auth_headers)
235-
236-
237221
@when(
238222
parsers.re(
239223
r'I request data from the APIM endpoint "(?P<resource_name>.*?)" with query params "(?P<params>.*?)" with status token'
@@ -294,15 +278,15 @@ def api_check_operation_outcome_any_issue_details_coding(fresponse, coding_type)
294278
target_fixture="fresponse",
295279
)
296280
def send_to_apim_get_with_ods_code_from_dynamo(
297-
api_request_context, dos_search_service_url, resource_name, ods_code, apigee_token
281+
api_request_context, dos_search_service_url, resource_name, ods_code, apim_token
298282
):
299283
logger.info(
300284
f"Requesting APIM URL: {dos_search_service_url}/{resource_name} with ODS code: {ods_code}"
301285
)
302286
url = dos_search_service_url + "/" + resource_name
303287
headers = {
304288
**MANDATORY_APIM_REQUEST_HEADERS,
305-
"Authorization": f"Bearer {apigee_token}",
289+
"Authorization": f"Bearer {apim_token}",
306290
}
307291
params = f"_revinclude=Endpoint:organization&identifier=https://fhir.nhs.uk/Id/ods-organization-code|{ods_code}"
308292
# logger.info(f"Requesting URL: {url} with params: {params} with headers: {headers}")

0 commit comments

Comments
 (0)