Fix Dremel 3D printer tests (#119853)

This commit is contained in:
Joost Lekkerkerker 2024-06-17 19:17:52 +02:00 committed by GitHub
parent 2560d7aeda
commit e5eef7c6dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,23 +32,23 @@ def config_entry(hass: HomeAssistant) -> MockConfigEntry:
@pytest.fixture
def connection() -> None:
"""Mock Dremel 3D Printer connection."""
mock = requests_mock.Mocker()
mock.post(
f"http://{HOST}:80/command",
response_list=[
{"text": load_fixture("dremel_3d_printer/command_1.json")},
{"text": load_fixture("dremel_3d_printer/command_2.json")},
{"text": load_fixture("dremel_3d_printer/command_1.json")},
{"text": load_fixture("dremel_3d_printer/command_2.json")},
],
)
with requests_mock.Mocker() as mock:
mock.post(
f"http://{HOST}:80/command",
response_list=[
{"text": load_fixture("dremel_3d_printer/command_1.json")},
{"text": load_fixture("dremel_3d_printer/command_2.json")},
{"text": load_fixture("dremel_3d_printer/command_1.json")},
{"text": load_fixture("dremel_3d_printer/command_2.json")},
],
)
mock.post(
f"https://{HOST}:11134/getHomeMessage",
text=load_fixture("dremel_3d_printer/get_home_message.json"),
status_code=HTTPStatus.OK,
)
mock.start()
mock.post(
f"https://{HOST}:11134/getHomeMessage",
text=load_fixture("dremel_3d_printer/get_home_message.json"),
status_code=HTTPStatus.OK,
)
yield
def patch_async_setup_entry():