def test_individual_case_id_not_present_when_case_type_ce(): metadata = { "region_code": "GB-ENG", "case_id": str(uuid4()), "case_type": "CE" } fulfilment_request = IndividualResponseFulfilmentRequest(metadata) json_message = json_loads(fulfilment_request.message) assert "individualCaseId" not in json_message["payload"][ "fulfilmentRequest"]
def test_fulfilment_code_for_postal(region_code, expected_fulfilment_code): metadata = { "region_code": region_code, "case_id": str(uuid4()), "case_type": "SPG" } fulfilment_request = IndividualResponseFulfilmentRequest(metadata) json_message = json_loads(fulfilment_request.message) assert (json_message["payload"]["fulfilmentRequest"]["fulfilmentCode"] == expected_fulfilment_code)
def test_postal_fulfilment_request_message(): metadata = {"region_code": "GB-ENG", "case_id": str(uuid4())} fulfilment_request = IndividualResponseFulfilmentRequest(metadata) postal_json_message = json_loads(fulfilment_request.message) payload = postal_json_message["payload"] validate_uuids_in_payload(payload) expected_sms_payload = { "fulfilmentRequest": { "fulfilmentCode": "P_UAC_UACIPA1", "contact": {}, } } assert payload == expected_sms_payload
def test_sms_fulfilment_request_payload(): metadata = {"region_code": "GB-ENG", "case_id": str(uuid4())} fulfilment_request = IndividualResponseFulfilmentRequest( metadata, DUMMY_MOBILE_NUMBER) sms_json_message = json_loads(fulfilment_request.message) payload = sms_json_message["payload"] validate_uuids_in_payload(payload) expected_sms_payload = { "fulfilmentRequest": { "fulfilmentCode": "UACITA1", "contact": { "telNo": sanitise_mobile_number(DUMMY_MOBILE_NUMBER) }, } } assert sms_json_message["payload"] == expected_sms_payload