Skip to content

Commit 7ad3bb9

Browse files
NRL-1986 Address PR comments
1 parent 6eb0ae6 commit 7ad3bb9

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

layer/nrlf/core/decorators.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
PERMISSION_ALLOW_ALL_POINTER_TYPES,
2626
X_CORRELATION_ID_HEADER,
2727
X_REQUEST_ID_HEADER,
28+
AccessControls,
2829
PointerTypes,
2930
)
3031
from nrlf.core.dynamodb.repository import DocumentPointerRepository
@@ -164,7 +165,10 @@ def _load_v2_connection_metadata(headers: Dict[str, str], path: str):
164165
pointer_permissions
165166
)
166167

167-
if "allow_all_types" in metadata.nrl_permissions_policy.access_controls:
168+
if (
169+
AccessControls.ALLOW_ALL_TYPES.value
170+
in metadata.nrl_permissions_policy.access_controls
171+
):
168172
metadata.nrl_permissions_policy.types = PointerTypes.list()
169173

170174
logger.log(

layer/nrlf/core/tests/test_decorators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from nrlf.core.constants import (
1313
PERMISSION_ALLOW_ALL_POINTER_TYPES,
1414
X_REQUEST_ID_HEADER,
15+
AccessControls,
1516
PointerTypes,
1617
V2Headers,
1718
)
@@ -851,7 +852,7 @@ def test_load_v2_connection_metadata_allow_all_types(mocker: MockerFixture):
851852
mocker.patch(
852853
"nrlf.core.decorators.get_pointer_permissions_v2",
853854
return_value={
854-
"access_controls": ["allow_all_types"],
855+
"access_controls": [AccessControls.ALLOW_ALL_TYPES.value],
855856
"types": [],
856857
},
857858
)

tests/utilities/api_clients.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
from pydantic import BaseModel
77
from requests import Response
88

9-
from nrlf.core.constants import Categories, PointerTypes, V2Headers
9+
from nrlf.core.constants import (
10+
NHSD_CORRELATION_ID_HEADER,
11+
Categories,
12+
PointerTypes,
13+
V2Headers,
14+
)
1015
from nrlf.core.model import ConnectionMetadata
1116

1217
logger = logging.getLogger(__name__)
@@ -83,7 +88,7 @@ def __init__(self, config: ClientConfig, use_v2: bool = False):
8388
{
8489
V2Headers.NHSD_END_USER_ORGANISATION_ODS: self.config.connection_metadata.ods_code,
8590
V2Headers.NHSD_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
86-
"NHSD-Correlation-Id": "test-correlation-id",
91+
NHSD_CORRELATION_ID_HEADER: "test-correlation-id",
8792
}
8893
)
8994
else:
@@ -232,9 +237,9 @@ def __init__(self, config: ClientConfig, use_v2: bool = False):
232237
if use_v2:
233238
self.request_headers.update(
234239
{
235-
"NHSD-End-User-Organisation-ODS": self.config.connection_metadata.ods_code,
236-
"NHSD-NRL-App-Id": self.config.connection_metadata.nrl_app_id,
237-
"NHSD-Correlation-Id": "test-correlation-id",
240+
V2Headers.NHSD_END_USER_ORGANISATION_ODS: self.config.connection_metadata.ods_code,
241+
V2Headers.NHSD_NRL_APP_ID: self.config.connection_metadata.nrl_app_id,
242+
NHSD_CORRELATION_ID_HEADER: "test-correlation-id",
238243
}
239244
)
240245
else:

0 commit comments

Comments
 (0)