mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Set API key as session header on MagicPlanClient construction 🟥
This commit is contained in:
parent
a672c0dea0
commit
da4f5f44c0
1 changed files with 9 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ def _load_fixture(name: str) -> dict[str, Any]:
|
|||
|
||||
|
||||
def _make_client(mock_session: MagicMock) -> MagicPlanClient:
|
||||
mock_session.headers = {}
|
||||
with patch(
|
||||
"backend.magic_plan.magic_plan_client.requests.Session",
|
||||
return_value=mock_session,
|
||||
|
|
@ -44,7 +45,14 @@ def test_customer_header_set_on_session(mock_session: MagicMock) -> None:
|
|||
# Act
|
||||
_make_client(mock_session)
|
||||
# Assert
|
||||
mock_session.headers.update.assert_called_once_with({"customer": CUSTOMER_ID})
|
||||
assert mock_session.headers["customer"] == CUSTOMER_ID
|
||||
|
||||
|
||||
def test_api_key_header_set_on_session(mock_session: MagicMock) -> None:
|
||||
# Act
|
||||
_make_client(mock_session)
|
||||
# Assert
|
||||
assert mock_session.headers["key"] == API_KEY
|
||||
|
||||
|
||||
# --- get_plans ---
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue