Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_read_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_read_document_reference_unauthorised_for_type_v2(
headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
headers.pop("nhsd-client-rp-details")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_search_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -745,7 +745,7 @@ def test_search_document_reference_invalid_type_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_search_post_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -503,7 +503,7 @@ def test_search_post_document_reference_invalid_type_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def test_create_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -810,7 +810,7 @@ def test_create_document_reference_pointer_type_not_allowed_v2(
headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
headers.pop("nhsd-client-rp-details")
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def test_supersede_non_existent_pointer_succeeds_with_v2_access_control(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def test_supersede_fails_without_v2_access_control(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_search_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -536,7 +536,7 @@ def test_search_document_reference_filters_by_pointer_types_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_search_post_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -555,7 +555,7 @@ def test_search_post_document_reference_filters_by_pointer_types_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_upsert_document_reference_happy_path_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -825,7 +825,7 @@ def test_upsert_document_reference_pointer_type_not_allowed_v2(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -1536,7 +1536,7 @@ def test_supersede_non_existent_pointer_succeeds_with_v2_access_control(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down Expand Up @@ -1605,7 +1605,7 @@ def test_supersede_fails_without_v2_access_control(
v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
v2_headers.pop(CLIENT_RP_DETAILS)
Expand Down
2 changes: 1 addition & 1 deletion layer/nrlf/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Source(Enum):

class V2Headers(str, Enum):
NHSD_END_USER_ORGANISATION_ODS = "nhsd-end-user-organisation-ods"
NHSD_NRL_APP_ID = "nhsd-nrl-app-id"
X_PROXYGEN_APP_NRL_APP_ID = "x-proxygen-app-nrl-app-id"


PERMISSION_AUDIT_DATES_FROM_PAYLOAD = "audit-dates-from-payload"
Expand Down
2 changes: 1 addition & 1 deletion layer/nrlf/core/log_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LogReference(Enum):
"WARN", "Missing nhsd-end-user-organisation-ods header for v2 permissions"
)
HANDLER003b = _Reference(
"WARN", "Missing nhsd-nrl-app-id header for v2 permissions"
"WARN", "Missing x-proxygen-app-nrl-app-id header for v2 permissions"
)
HANDLER004 = _Reference("INFO", "Authorisation lookup enabled")
HANDLER004a = _Reference("INFO", "Authorisation lookup skipped for sync request")
Expand Down
2 changes: 1 addition & 1 deletion layer/nrlf/core/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _fetch_v2_ods_app_id_headers(headers: dict[str, str]):
headers_names=list(case_insensitive_headers.keys()),
)

nrl_app_id = case_insensitive_headers.get(V2Headers.NHSD_NRL_APP_ID)
nrl_app_id = case_insensitive_headers.get(V2Headers.X_PROXYGEN_APP_NRL_APP_ID)
if not nrl_app_id or len(nrl_app_id.strip()) == 0:
logger.log(
LogReference.HANDLER003b,
Expand Down
8 changes: 4 additions & 4 deletions layer/nrlf/core/tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def _create_v2_headers() -> dict:
headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)
headers.pop("nhsd-client-rp-details")
Expand Down Expand Up @@ -870,7 +870,7 @@ def test_load_connection_metadata_gets_v2_permissions_when_v1_headers_also_provi
v1_plus_v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)

Expand Down Expand Up @@ -901,7 +901,7 @@ def test_load_connection_metadata_gets_v1_permissions_when_v2_permission_file_mi
v1_plus_v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)

Expand Down Expand Up @@ -932,7 +932,7 @@ def test_load_connection_metadata_throws_error_when_v2_permissions_lookup_encoun
v1_plus_v2_headers = create_headers(
additional_headers={
V2Headers.NHSD_END_USER_ORGANISATION_ODS: "Y05868",
V2Headers.NHSD_NRL_APP_ID: "Y05868-TestApp-12345678",
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: "Y05868-TestApp-12345678",
}
)

Expand Down
8 changes: 4 additions & 4 deletions layer/nrlf/core/tests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(
{
"NHSD-end-USER-organISAtion-oDs": "ODS123",
"nhsd-nrl-app-id": "This-is-an-app-id",
"x-proxygen-app-nrl-app-id": "This-is-an-app-id",
},
"ODS123",
"This-is-an-app-id",
Expand All @@ -31,13 +31,13 @@
),
(
{
"nHSd-nrL-aPp-Id": "This-is-an-app-id",
"x-pROXyGen-aPp-nRl-ApP-Id": "This-is-an-app-id",
},
None,
"This-is-an-app-id",
{
"code": LogReference.HANDLER003a,
"headers_names": ["nhsd-nrl-app-id"],
"headers_names": ["x-proxygen-app-nrl-app-id"],
},
),
(
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_parse_headers_valid_headers_v2_permissions():
}
),
"nhsd-end-user-organisation-ods": "X26",
"nhsd-nrl-app-id": "X26-TestApp-12345",
"x-proxygen-app-nrl-app-id": "X26-TestApp-12345",
}

metadata = parse_headers(headers)
Expand Down
4 changes: 2 additions & 2 deletions tests/utilities/api_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, config: ClientConfig):
"NHSD-Connection-Metadata": json.dumps(connection_metadata),
"NHSD-Client-RP-Details": json.dumps(client_rp_details),
V2Headers.NHSD_END_USER_ORGANISATION_ODS: self.config.connection_metadata.ods_code,
V2Headers.NHSD_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
NHSD_CORRELATION_ID_HEADER: "test-correlation-id",
}
)
Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(self, config: ClientConfig):
"NHSD-Connection-Metadata": json.dumps(connection_metadata),
"NHSD-Client-RP-Details": json.dumps(client_rp_details),
V2Headers.NHSD_END_USER_ORGANISATION_ODS: self.config.connection_metadata.ods_code,
V2Headers.NHSD_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
V2Headers.X_PROXYGEN_APP_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
NHSD_CORRELATION_ID_HEADER: "test-correlation-id",
}
)
Expand Down
Loading