diff --git a/test_team_2.py b/test_team_2.py index ff0f222..4fb9efb 100644 --- a/test_team_2.py +++ b/test_team_2.py @@ -78,6 +78,24 @@ def test_url(self): def test_uk_nhs(self): """Test uk_nhs functionality""" + # positive testcases + prefix = ['123', '245', '532'] + mid = ['333', '444', '555'] + suffix = ['6789', '2232', '4832'] + + # Generates a testcase by utting the prefix, mid, and suffix together + test_cases = [f"My NHS number is {p}-{m}-{s}" for p in prefix for m in mid for s in suffix] + + for test_string in test_cases: + expected = 'My NHS number is ' + actual = anonymize_text(test_string, ['UK_NHS']) + self.assertEqual(expected, actual) + + # negative testcase - this will not be replaced + test_string = 'My NHS number is 123-456-7890' + expected = 'My NHS number is 123-456-7890' + actual = anonymize_text(test_string, ['UK_NHS']) + self.assertEqual(expected, actual) def test_it_passport(self): """Test it_passport functionality"""