mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
minor updates following Abri feedback
This commit is contained in:
parent
6137a0e946
commit
7997d88375
4 changed files with 26 additions and 10 deletions
|
|
@ -49,7 +49,8 @@ class LogJobRequest:
|
|||
@dataclass(frozen=True)
|
||||
class JobLogged:
|
||||
job_no: str
|
||||
logged_info: str
|
||||
# Informational only (never read downstream); absent on some successes.
|
||||
logged_info: Optional[str]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class SelectedPhoneNumbers:
|
|||
secondary: Optional[str]
|
||||
|
||||
|
||||
# TODO(#1474): confirm the priority ordering with Abri — this assumes the
|
||||
# lowest numeric priority marks the preferred number, and that entries with
|
||||
# a missing or non-numeric priority rank last (ties keep document order).
|
||||
# Abri confirmed the lowest numeric priority marks the preferred number;
|
||||
# entries with a missing or non-numeric priority rank last (ties keep
|
||||
# document order).
|
||||
def _priority_sort_key(entry: PhoneEntry) -> Tuple[int, int]:
|
||||
"""Sort key: lowest numeric priority first; unusable priorities last."""
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -174,14 +174,13 @@ class AbriClient:
|
|||
)
|
||||
|
||||
job_no = job_logged.get("job_no")
|
||||
logged_info = job_logged.get("logged_info")
|
||||
|
||||
if job_no is None or logged_info is None:
|
||||
raise AbriResponseParseError(
|
||||
"Job_logged element missing job_no or logged_info"
|
||||
)
|
||||
if job_no is None:
|
||||
raise AbriResponseParseError("Job_logged element missing job_no")
|
||||
|
||||
return JobLogged(job_no=job_no, logged_info=logged_info)
|
||||
# logged_info is purely informational and absent on some successes, so
|
||||
# its presence is not required to accept the job as logged.
|
||||
return JobLogged(job_no=job_no, logged_info=job_logged.get("logged_info"))
|
||||
|
||||
@staticmethod
|
||||
def _parse_appointment_amended(root: ET.Element) -> AppointmentAmended:
|
||||
|
|
|
|||
|
|
@ -106,6 +106,22 @@ def test_log_job_returns_job_logged_with_openhousing_job_number(
|
|||
)
|
||||
|
||||
|
||||
def test_log_job_accepts_a_success_without_logged_info(
|
||||
client: AbriClient, mock_session: MagicMock
|
||||
) -> None:
|
||||
# Arrange: logged_info is informational, so a success carrying only a
|
||||
# job_no must still be accepted rather than fail a job that was logged.
|
||||
mock_session.post.return_value.content = (
|
||||
b'<Root><Jobs><Job_logged job_no="AD1" /></Jobs></Root>'
|
||||
)
|
||||
|
||||
# Act
|
||||
result = client.log_job(_spec_example_request())
|
||||
|
||||
# Assert
|
||||
assert result == JobLogged(job_no="AD1", logged_info=None)
|
||||
|
||||
|
||||
def test_log_job_sends_the_recorded_logjob_envelope_to_the_relay_endpoint(
|
||||
client: AbriClient, mock_session: MagicMock
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue