|
5 | 5 | from pytest_mock import MockerFixture |
6 | 6 |
|
7 | 7 | from nrlf.core.codes import SpineErrorConcept |
8 | | -from nrlf.core.decorators import deprecated, error_handler, request_handler |
| 8 | +from nrlf.core.config import Config |
| 9 | +from nrlf.core.decorators import ( |
| 10 | + deprecated, |
| 11 | + error_handler, |
| 12 | + load_connection_metadata, |
| 13 | + request_handler, |
| 14 | +) |
9 | 15 | from nrlf.core.errors import OperationOutcomeError |
10 | 16 | from nrlf.core.response import Response |
11 | 17 | from nrlf.tests.events import ( |
@@ -422,6 +428,30 @@ def decorated_function(event, context, config, metadata) -> Response: |
422 | 428 | } |
423 | 429 |
|
424 | 430 |
|
| 431 | +def test_request_load_connection_metadata_with_permission_headers(): |
| 432 | + expected_metdata = load_connection_metadata( |
| 433 | + headers=create_headers(nrl_permissions=["somePermission"]), config=Config() |
| 434 | + ) |
| 435 | + |
| 436 | + assert expected_metdata.pointer_types == [ |
| 437 | + "http://snomed.info/sct|736253002", |
| 438 | + "http://snomed.info/sct|1363501000000100", |
| 439 | + "http://snomed.info/sct|1382601000000107", |
| 440 | + "http://snomed.info/sct|325691000000100", |
| 441 | + "http://snomed.info/sct|736373009", |
| 442 | + "http://snomed.info/sct|861421000000109", |
| 443 | + "http://snomed.info/sct|887701000000100", |
| 444 | + ] |
| 445 | + |
| 446 | + |
| 447 | +def test_request_load_connection_metadata_with_no_permission_headers(): |
| 448 | + expected_metdata = load_connection_metadata( |
| 449 | + headers=create_headers(), config=Config() |
| 450 | + ) |
| 451 | + |
| 452 | + assert expected_metdata.pointer_types == ["http://snomed.info/sct|736253002"] |
| 453 | + |
| 454 | + |
425 | 455 | def test_request_handler_with_custom_repository(mocker: MockerFixture): |
426 | 456 | repository_mock = mocker.Mock() |
427 | 457 |
|
|
0 commit comments