Skip to content

Commit 60425b1

Browse files
modified the api response - need refractoring later
1 parent f7988d0 commit 60425b1

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/eligibility_signposting_api/model/eligibility.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
from datetime import date
55
from enum import Enum, StrEnum, auto
66
from functools import total_ordering
7-
from typing import TYPE_CHECKING, NewType, Self
7+
from typing import NewType, Self
88

9-
if TYPE_CHECKING:
10-
from eligibility_signposting_api.model import rules
9+
from eligibility_signposting_api.model.rules import IterationCohort
1110

1211
NHSNumber = NewType("NHSNumber", str)
1312
DateOfBirth = NewType("DateOfBirth", date)
@@ -75,7 +74,7 @@ class Condition:
7574

7675
@dataclass
7776
class CohortStatus:
78-
cohort: rules.IterationCohort
77+
cohort: IterationCohort
7978
status: Status
8079
reasons: list[Reason]
8180

src/eligibility_signposting_api/views/eligibility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def build_eligibility_response(
6666
rule_code=eligibility.RuleCode(reason.rule_name), # pyright: ignore[reportCallIssue]
6767
rule_text=eligibility.RuleText(reason.rule_result), # pyright: ignore[reportCallIssue]
6868
)
69-
for reason in condition.reasons
69+
for cohort_result in condition.cohort_results
70+
for reason in cohort_result.reasons
7071
], # pyright: ignore[reportCallIssue]
7172
actions=[],
7273
)

tests/unit/views/test_eligibility.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
from http import HTTPStatus
33

4-
import pytest
54
from brunns.matchers.data import json_matching as is_json_that
65
from brunns.matchers.werkzeug import is_werkzeug_response as is_response
76
from flask import Flask
@@ -40,7 +39,6 @@ def get_eligibility_status(self, _: NHSNumber | None = None) -> EligibilityStatu
4039
raise ValueError
4140

4241

43-
@pytest.mark.skip(reason="Skipping this test for now, the api response has to be corrected")
4442
def test_nhs_number_given(app: Flask, client: FlaskClient):
4543
# Given
4644
with get_app_container(app).override.service(EligibilityService, new=FakeEligibilityService()):

0 commit comments

Comments
 (0)