Skip to content

Commit

Permalink
rename symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Jan 2, 2025
1 parent 59b39da commit 9155f18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions tests/tests/test_v0_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from evohomeasync import exceptions as exc
from evohomeasync.auth import _APPLICATION_ID
from tests.const import HEADERS_CRED_V0 as HEADERS_CRED, URL_CRED_V0 as URL_CRED
from tests.const import HEADERS_CRED_V0, URL_CRED_V0

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -60,13 +60,13 @@ def server_response() -> dict[str, dict[str, Any] | str]:
"message": "The email or password provided is incorrect.",
}
]
rsp.post(URL_CRED, status=HTTPStatus.UNAUTHORIZED, payload=response)
rsp.post(URL_CRED_V0, status=HTTPStatus.UNAUTHORIZED, payload=response)

with pytest.raises(exc.AuthenticationFailedError):
await session_manager.get_session_id()

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_password
URL_CRED_V0, HTTPMethod.POST, headers=HEADERS_CRED_V0, data=data_password
)

assert session_manager.is_session_id_valid() is False
Expand All @@ -76,12 +76,12 @@ def server_response() -> dict[str, dict[str, Any] | str]:
payload = server_response()

with aioresponses() as rsp:
rsp.post(URL_CRED, payload=payload)
rsp.post(URL_CRED_V0, payload=payload)

assert await session_manager.get_session_id() == payload["sessionId"]

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_password
URL_CRED_V0, HTTPMethod.POST, headers=HEADERS_CRED_V0, data=data_password
)

assert session_manager.is_session_id_valid() is True
Expand Down Expand Up @@ -110,12 +110,12 @@ def server_response() -> dict[str, dict[str, Any] | str]:
payload = server_response()

with aioresponses() as rsp:
rsp.post(URL_CRED, payload=payload)
rsp.post(URL_CRED_V0, payload=payload)

assert await session_manager.get_session_id() == payload["sessionId"]

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_password
URL_CRED_V0, HTTPMethod.POST, headers=HEADERS_CRED_V0, data=data_password
)

assert session_manager.is_session_id_valid() is True
Expand Down
14 changes: 7 additions & 7 deletions tests/tests/test_v2_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from cli.auth import CredentialsManager

from evohomeasync2 import exceptions as exc
from tests.const import HEADERS_CRED_V2 as HEADERS_CRED, URL_CRED_V2 as URL_CRED
from tests.const import HEADERS_CRED_V2, URL_CRED_V2

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -63,13 +63,13 @@ def server_response() -> dict[str, int | str]:
response = {
"error": "invalid_grant",
}
rsp.post(URL_CRED, status=HTTPStatus.UNAUTHORIZED, payload=response)
rsp.post(URL_CRED_V2, status=HTTPStatus.UNAUTHORIZED, payload=response)

with pytest.raises(exc.AuthenticationFailedError):
await token_manager.get_access_token()

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_password
URL_CRED_V2, HTTPMethod.POST, headers=HEADERS_CRED_V2, data=data_password
)

assert token_manager.is_access_token_valid() is False
Expand All @@ -79,12 +79,12 @@ def server_response() -> dict[str, int | str]:
payload = server_response()

with aioresponses() as rsp:
rsp.post(URL_CRED, payload=payload)
rsp.post(URL_CRED_V2, payload=payload)

assert await token_manager.get_access_token() == payload["access_token"]

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_password
URL_CRED_V2, HTTPMethod.POST, headers=HEADERS_CRED_V2, data=data_password
)

assert token_manager.is_access_token_valid() is True
Expand Down Expand Up @@ -116,12 +116,12 @@ def server_response() -> dict[str, int | str]:
payload = server_response()

with aioresponses() as rsp:
rsp.post(URL_CRED, payload=payload)
rsp.post(URL_CRED_V2, payload=payload)

assert await token_manager.get_access_token() == payload["access_token"]

rsp.assert_called_once_with(
URL_CRED, HTTPMethod.POST, headers=HEADERS_CRED, data=data_token
URL_CRED_V2, HTTPMethod.POST, headers=HEADERS_CRED_V2, data=data_token
)

assert token_manager.is_access_token_valid() is True
Expand Down

0 comments on commit 9155f18

Please sign in to comment.