Skip to content

Commit df1e43d

Browse files
Added global const for secret
1 parent 413471a commit df1e43d

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

tests/integration/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
AWS_REGION = "eu-west-1"
4848

49+
AWS_CURRENT_SECRET = "test_value"
50+
AWS_PREVIOUS_SECRET = "test_value_old"
4951

5052
@pytest.fixture(scope="session")
5153
def localstack(request: pytest.FixtureRequest) -> URL:
@@ -1045,7 +1047,7 @@ def campaign_config_with_missing_descriptions_missing_rule_text(
10451047

10461048
# If you put StubSecretRepo in a separate module, import it instead
10471049
class StubSecretRepo(SecretRepo):
1048-
def __init__(self, current: str = "test_value", previous: str = "test_value_old"):
1050+
def __init__(self, current: str = AWS_CURRENT_SECRET, previous: str = AWS_PREVIOUS_SECRET):
10491051
self._current = current
10501052
self._previous = previous
10511053

@@ -1059,8 +1061,8 @@ def get_secret_previous(self, secret_name: str) -> dict[str, str]:
10591061
@pytest.fixture
10601062
def hashing_service() -> HashingService:
10611063
secret_repo = StubSecretRepo(
1062-
current="test_value",
1063-
previous="test_value_old",
1064+
current=AWS_CURRENT_SECRET,
1065+
previous=AWS_PREVIOUS_SECRET,
10641066
)
10651067

10661068
# The actual value of the name does not matter for the stub,

tests/integration/repo/test_person_repo.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,24 @@ def test_items_found_but_person_attribute_type_not_found_raises_error(
5757
repo.get_eligibility_data(persisted_person_with_no_person_attribute_type)
5858

5959

60-
# def test_person_found_with_current_secret(person_table: Any,
61-
# persisted_person: NHSNumber,
62-
# hashing_service: HashingService,):
63-
# # Given
64-
# repo = PersonRepo(person_table, hashing_service)
65-
#
66-
# # When
67-
# actual = repo.get_eligibility_data(persisted_person)
68-
#
69-
# # Then
70-
# nhs_num_hash = hashing_service.hash_with_current_secret(persisted_person)
71-
#
72-
# assert_that(
73-
# actual.data,
74-
# contains_inanyorder(
75-
# has_entries({"NHS_NUMBER": nhs_num_hash, "ATTRIBUTE_TYPE": "PERSON"}),
76-
# has_entries({"NHS_NUMBER": nhs_num_hash, "ATTRIBUTE_TYPE": "COHORTS"}),
77-
# ),
78-
# )
60+
def test_person_found_with_current_secret(person_table: Any,
61+
persisted_person: NHSNumber,
62+
hashing_service: HashingService):
63+
# Given
64+
repo = PersonRepo(person_table, hashing_service)
65+
66+
# When
67+
actual = repo.get_eligibility_data(persisted_person)
68+
69+
# Then
70+
nhs_num_hash = hashing_service.hash_with_current_secret(persisted_person)
71+
nhs_num_hash_pre = hashing_service.hash_with_previous_secret(persisted_person)
72+
73+
74+
assert_that(
75+
actual.data,
76+
contains_inanyorder(
77+
has_entries({"NHS_NUMBER": nhs_num_hash, "ATTRIBUTE_TYPE": "PERSON"}),
78+
has_entries({"NHS_NUMBER": nhs_num_hash, "ATTRIBUTE_TYPE": "COHORTS"}),
79+
),
80+
)

0 commit comments

Comments
 (0)