Skip to content

Commit 7e7c82d

Browse files
committed
updated extract status text override method to allow empty list aswell as None to allow integration test to pass
1 parent 0007447 commit 7e7c82d

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/eligibility_signposting_api/services/processors/action_rule_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,12 @@ def _get_actions_from_comms(action_mapper: ActionsMapper, comms: str) -> list[Su
111111
def _extract_status_text_override(
112112
actions: list[SuggestedAction] | None,
113113
) -> tuple[list[SuggestedAction] | None, StatusText | None]:
114-
if not actions:
114+
if actions is None:
115115
return None, None
116116

117+
if len(actions) == 0:
118+
return [], None
119+
117120
override_text = None
118121
remaining = []
119122
for action in actions:
@@ -122,4 +125,4 @@ def _extract_status_text_override(
122125
else:
123126
remaining.append(action)
124127

125-
return remaining or None, override_text
128+
return remaining, override_text

tests/unit/services/processors/test_action_rule_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ def test_extract_status_text_override_with_none_returns_none_none():
843843
def test_extract_status_text_override_with_empty_list_returns_none_none():
844844
result = ActionRuleHandler._extract_status_text_override([])
845845

846-
assert_that(result, is_((None, None)))
846+
assert_that(result, is_(([], None)))
847847

848848

849849
def test_extract_status_text_override_with_no_override_action_leaves_actions_unchanged():
@@ -860,7 +860,7 @@ def test_extract_status_text_override_with_only_override_action_captures_text():
860860

861861
remaining, override_text = ActionRuleHandler._extract_status_text_override(actions)
862862

863-
assert_that(remaining, is_(None))
863+
assert_that(remaining, is_([]))
864864
assert_that(override_text, is_(StatusText("You maybe eligible for a vaccination")))
865865

866866

0 commit comments

Comments
 (0)