File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -225,3 +225,28 @@ def assert_error_response(
225225
226226 for renamed_header in RenamedHeader :
227227 assert renamed_header .renamed not in client_response_headers
228+
229+
230+ def assert_error_response_with_body (
231+ response : Response , expected_correlation_id : int , expected_status_code : int
232+ ):
233+ # Verify the status
234+ assert response .status_code == expected_status_code , (
235+ "Expected a "
236+ + expected_status_code
237+ + " when accessing the api but got "
238+ + (str )(response .status_code )
239+ )
240+
241+ assert len (response .content ) > 0
242+
243+ # Verify the response headers
244+ client_response_headers = response .headers
245+
246+ assert (
247+ client_response_headers [RenamedHeader .CORRELATION_ID .original ]
248+ == expected_correlation_id
249+ )
250+
251+ for renamed_header in RenamedHeader :
252+ assert renamed_header .renamed not in client_response_headers
Original file line number Diff line number Diff line change 22import requests
33from requests import Response
44from tests .data import RenamedHeader
5- from tests .asserts import assert_ok_response , assert_error_response
5+ from tests .asserts import (
6+ assert_ok_response ,
7+ assert_error_response ,
8+ assert_error_response_with_body ,
9+ )
610
711_HEADER_AUTHORIZATION = "Authorization"
812_HEADER_ECHO = "echo" # enable echo target
@@ -42,7 +46,7 @@ async def test_authorised_application_not_supported_for_user_restricted(
4246 f"{ service_url } { _SPECIALTY_REF_DATA_URL } " , headers = client_request_headers
4347 )
4448
45- assert_error_response (response , _EXPECTED_CORRELATION_ID , 403 )
49+ assert_error_response_with_body (response , _EXPECTED_CORRELATION_ID , 403 )
4650
4751 def test_authorised_application_supported_for_app_restricted (
4852 self , app_restricted_access_code , service_url
You can’t perform that action at this time.
0 commit comments