Skip to content

Commit 091a81e

Browse files
committed
test_convert_disease_codes_to_vaccine_type
1 parent 0233b38 commit 091a81e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

backend/tests/test_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ def tearDown(self):
2121
"""Tear down after each test. This runs after every test"""
2222
self.redis_patcher.stop()
2323

24-
def test_convert_disease_codes_to_vaccine_type(self):
24+
def test_convert_disease_codes_to_vaccine_type_returns_vaccine_type(self):
2525
"""
26-
Test that disease_codes_to_vaccine_type returns correct vaccine type for valid combinations,
27-
of disease codes, or raises a value error otherwise
26+
If the mock returns a vaccine type, convert_disease_codes_to_vaccine_type returns that vaccine type.
2827
"""
29-
# Valid combinations return appropriate vaccine type
3028
valid_combinations = [
3129
(["840539006"], "COVID19"),
3230
(["6142004"], "FLU"),
@@ -41,14 +39,16 @@ def test_convert_disease_codes_to_vaccine_type(self):
4139
for combination, vaccine_type in valid_combinations:
4240
self.assertEqual(convert_disease_codes_to_vaccine_type(combination), vaccine_type)
4341

44-
# Invalid combinations raise value error
42+
def test_convert_disease_codes_to_vaccine_type_raises_error_on_none(self):
43+
"""
44+
If the mock returns None, convert_disease_codes_to_vaccine_type raises a ValueError.
45+
"""
4546
invalid_combinations = [
4647
["8405390063"],
4748
["14189004"],
4849
["14189004", "36989005"],
4950
["14189004", "36989005", "36653000", "840539006"],
5051
]
51-
5252
self.mock_redis_client.hget.side_effect = None
5353
self.mock_redis_client.hget.return_value = None # Simulate no match in Redis for invalid combinations
5454
for invalid_combination in invalid_combinations:

0 commit comments

Comments
 (0)