def test_flag_put(self): # Pre-Req: Patient has both a consent and flag Utils.send_consent_post(self.token) Utils.send_flag_post(self.token) get_flag_response = Utils.send_flag_get(self.token) # Given expected_status_code = 200 flag_id = get_flag_response['id'] version_id = get_flag_response['version'] # When response = requests.put( url=config.REASONABLE_ADJUSTMENTS_FLAG + '/' + flag_id, headers={ 'Authorization': f'Bearer {self.token}', 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID, 'x-request-id': str(uuid.uuid4()), 'content-type': 'application/fhir+json', 'Accept': 'application/fhir+json', 'If-match': version_id, }, json=request_bank.get_body(Request.FLAG_PUT) ) # Then assert_that(expected_status_code).is_equal_to(response.status_code)
def test_flag_get_with_flag(self): # Pre-Req: Patient record with both a consent and flag Utils.send_consent_post(self.token) Utils.send_flag_post(self.token) # Given expected_status_code = 200 # When response = requests.get( url=config.REASONABLE_ADJUSTMENTS_FLAG, params={ 'patient': config.TEST_PATIENT_NHS_NUMBER, 'category': 'https://fhir.nhs.uk/STU3/CodeSystem/RARecord-FlagCategory-1|NRAF', 'status': 'active' }, headers={ 'Authorization': f'Bearer {self.token}', 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID, 'x-request-id': str(uuid.uuid4()), 'content-type': 'application/fhir+json', 'Accept': 'application/fhir+json' } ) # Then assert_that(expected_status_code).is_equal_to(response.status_code) result_dict = json.loads(response.text) assert_that(result_dict['total']).is_equal_to(1) # Validate patient record contains a flag