Skip to content

Commit

Permalink
harden tests - fix schema bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Dec 9, 2024
1 parent 8394d8d commit 9be4570
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/evohomeasync2/schemas/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def factory_status_response(fnc: Callable[[str], str] = noop) -> vol.Schema:

entry_schema = vol.Schema(
{
vol.Required("error"): str,
vol.Required("code"): str,
vol.Required("message"): str,
},
extra=vol.PREVENT_EXTRA,
Expand Down
16 changes: 8 additions & 8 deletions tests/tests_rf/test_v2_urls_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def handle_too_many_requests(rsp: aiohttp.ClientResponse) -> None:
"""

assert response["error"] == "attempt_limit_exceeded"
assert TCC_ERROR_RESPONSE(response), response
TCC_ERROR_RESPONSE(response)

pytest.skip("Too many requests")

Expand Down Expand Up @@ -101,7 +101,7 @@ async def test_url_auth_bad1( # invalid/unknown credentials
"""

assert response["error"] == "invalid_grant"
assert TCC_ERROR_RESPONSE(response), response
TCC_ERROR_RESPONSE(response)


@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason="requires vendor's webserver")
Expand Down Expand Up @@ -137,7 +137,7 @@ async def test_url_auth_bad2( # invalid/expired access token
assert isinstance(response, list) # mypy hint

assert response[0]["code"] == "Unauthorized"
assert TCC_STATUS_RESPONSE(response), response
TCC_STATUS_RESPONSE(response)


@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason="requires vendor's webserver")
Expand Down Expand Up @@ -171,7 +171,7 @@ async def test_url_auth_bad3( # invalid/expired refresh token
"""

assert response["error"] == "invalid_grant"
assert TCC_ERROR_RESPONSE(response), response
TCC_ERROR_RESPONSE(response)


@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason="requires vendor's webserver")
Expand Down Expand Up @@ -209,7 +209,7 @@ async def test_url_auth_good(
"""

assert user_auth["expires_in"] <= 1800 # noqa: PLR2004
assert TCC_POST_OAUTH_TOKEN(user_auth), user_auth
TCC_POST_OAUTH_TOKEN(user_auth)

# #################################################################################

Expand Down Expand Up @@ -245,7 +245,7 @@ async def test_url_auth_good(
"""

assert response["username"] == credentials[0]
assert TCC_GET_USR_ACCOUNT(response), response
TCC_GET_USR_ACCOUNT(response)

# #################################################################################

Expand All @@ -266,7 +266,7 @@ async def test_url_auth_good(

assert rsp.status == HTTPStatus.OK # 200

user_auth = await rsp.json()
user_auth = await rsp.json() # TODO: add TypedDict

# the expected response for good refresh tokens
"""
Expand All @@ -280,4 +280,4 @@ async def test_url_auth_good(
"""

assert user_auth["expires_in"] <= 1800 # noqa: PLR2004
assert TCC_POST_OAUTH_TOKEN(user_auth), user_auth
TCC_POST_OAUTH_TOKEN(user_auth)

0 comments on commit 9be4570

Please sign in to comment.