-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PRMP-1242: Fix missing auth service bug #466
Changes from 5 commits
6026195
11e48b5
07489c7
ac16b9c
69a3ecc
130179b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import pytest | ||
from services.mock_pds_service import MockPdsApiService | ||
from services.pds_api_service import PdsApiService | ||
from utils.exceptions import InvalidResourceIdException | ||
from utils.utilities import ( | ||
camelize_dict, | ||
flatten, | ||
get_file_key_from_s3_url, | ||
get_pds_service, | ||
redact_id_to_last_4_chars, | ||
validate_nhs_number, | ||
) | ||
|
@@ -34,6 +37,28 @@ def test_decapitalise_keys(): | |
assert actual == expected | ||
|
||
|
||
def test_get_pds_service_returns_stubbed_pds_when_true(monkeypatch): | ||
monkeypatch.setenv("PDS_FHIR_IS_STUBBED", "True") | ||
|
||
response = get_pds_service() | ||
|
||
assert isinstance(response, MockPdsApiService) | ||
|
||
|
||
def test_get_pds_service_returns_stubbed_pds_when_unset(): | ||
response = get_pds_service() | ||
|
||
assert isinstance(response, MockPdsApiService) | ||
|
||
|
||
def test_get_pds_service_returns_real_pds(monkeypatch): | ||
monkeypatch.setenv("PDS_FHIR_IS_STUBBED", "False") | ||
|
||
response = get_pds_service() | ||
|
||
assert isinstance(response, PdsApiService) | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've noticed that in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will make these parameterized. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good point actually, the terraform |
||
def test_redact_id(): | ||
mock_session_id = "1234532532432" | ||
expected = "2432" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of consistency, could we modify the name here to
pds_service
as set in other parts of the code? (e.g lloyd_george_validator.py line 215)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout! I like your thinking,
pds_api_service
is a pretty loaded term, being the name of the unstubbed service.