1111
1212def test_ping (nhsd_apim_proxy_url ):
1313 os .environ ["PROXY_NAME" ] = "dev"
14- with open ("smeg.txt" , "w" ) as smeg :
15- smeg .write (str (nhsd_apim_proxy_url ))
1614 resp = requests .get (f"{ nhsd_apim_proxy_url } /_ping" )
1715 assert resp .status_code == 200
1816
@@ -22,20 +20,23 @@ def test_wait_for_ping(nhsd_apim_proxy_url):
2220 resp = requests .get (f"{ nhsd_apim_proxy_url } /_ping" )
2321 deployed_commit_id = resp .json ().get ("commitId" )
2422
25- while (deployed_commit_id != getenv ('SOURCE_COMMIT_ID' )
26- and retries <= 30
27- and resp .status_code == 200 ):
23+ while (
24+ deployed_commit_id != getenv ('SOURCE_COMMIT_ID' ) and
25+ retries <= 30 and
26+ resp .status_code == 200
27+ ):
2828 resp = requests .get (f"{ nhsd_apim_proxy_url } /_ping" )
2929 deployed_commit_id = resp .json ().get ("commitId" )
3030 retries += 1
3131
3232 if resp .status_code != 200 :
3333 pytest .fail (f"Status code { resp .status_code } , expecting 200" )
34- elif retries >= 30 :
35- pytest .fail ("Timeout Error - max retries" )
3634
3735 assert deployed_commit_id == getenv ('SOURCE_COMMIT_ID' )
3836
37+ if retries >= 30 :
38+ pytest .fail ("Timeout Error - max retries" )
39+
3940
4041@pytest .mark .smoketest
4142@pytest .mark .skip (reason = "Dont need to run on prod" )
@@ -53,23 +54,27 @@ def test_wait_for_status(nhsd_apim_proxy_url, status_endpoint_auth_headers):
5354 resp = requests .get (f"{ nhsd_apim_proxy_url } /_status" , headers = status_endpoint_auth_headers )
5455 deployed_commit_id = resp .json ().get ("commitId" )
5556
56- while (deployed_commit_id != getenv ('SOURCE_COMMIT_ID' )
57- and retries <= 30
58- and resp .status_code == 200
59- and resp .json ().get ("version" )):
57+ while (
58+ deployed_commit_id != getenv ('SOURCE_COMMIT_ID' ) and
59+ retries <= 30 and
60+ resp .status_code == 200 and
61+ resp .json ().get ("version" )
62+ ):
6063 resp = requests .get (f"{ nhsd_apim_proxy_url } /_status" , headers = status_endpoint_auth_headers )
6164 deployed_commit_id = resp .json ().get ("commitId" )
6265 retries += 1
6366
6467 if resp .status_code != 200 :
6568 pytest .fail (f"Status code { resp .status_code } , expecting 200" )
66- elif retries >= 30 :
67- pytest .fail ("Timeout Error - max retries" )
68- elif not resp .json ().get ("version" ):
69- pytest .fail ("version not found" )
7069
7170 assert deployed_commit_id == getenv ('SOURCE_COMMIT_ID' )
7271
72+ if retries >= 30 :
73+ pytest .fail ("Timeout Error - max retries" )
74+
75+ if not resp .json ().get ("version" ):
76+ pytest .fail ("version not found" )
77+
7378
7479def test_app_unauthorised (nhsd_apim_proxy_url , nhsd_apim_auth_headers ):
7580 resp = requests .get (f"{ nhsd_apim_proxy_url } /conditions/" , headers = nhsd_apim_auth_headers )
0 commit comments