mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Abri log_job sends the spec's recorded LogJob envelope to the relay endpoint 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
dd451a03a8
commit
4803ae40e1
1 changed files with 24 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import xml.etree.ElementTree as ET
|
||||
from datetime import date
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
|
@ -75,3 +76,26 @@ def test_log_job_returns_job_logged_with_openhousing_job_number(
|
|||
"Short Description example job."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def test_log_job_sends_the_recorded_logjob_envelope_to_the_relay_endpoint(
|
||||
client: AbriClient, mock_session: MagicMock
|
||||
) -> None:
|
||||
# Arrange
|
||||
mock_session.post.return_value.content = _load_fixture(
|
||||
"abri_relay_logjob_success_response.xml"
|
||||
)
|
||||
|
||||
# Act
|
||||
client.log_job(_spec_example_request())
|
||||
|
||||
# Assert
|
||||
# Fixture is the spec's recorded request example, except resource_group is
|
||||
# "Surveyors" (the documented default) where the example used "surveyors".
|
||||
(url,) = mock_session.post.call_args.args
|
||||
sent_body: bytes = mock_session.post.call_args.kwargs["data"]
|
||||
expected_body = _load_fixture("abri_relay_logjob_request_example.xml")
|
||||
assert url == ENDPOINT_URL
|
||||
assert ET.canonicalize(xml_data=sent_body) == ET.canonicalize(
|
||||
xml_data=expected_body
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue