Use built-in test helpers on 3.8 (#34901)
This commit is contained in:
parent
6b16c34fd0
commit
ec47216388
303 changed files with 1163 additions and 1320 deletions
|
@ -1,12 +1,11 @@
|
|||
"""Tests for the client validator."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.auth import indieauth
|
||||
|
||||
from tests.common import mock_coro
|
||||
from tests.async_mock import patch
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
|
@ -113,9 +112,7 @@ async def test_verify_redirect_uri():
|
|||
None, "http://ex.com", "http://ex.com/callback"
|
||||
)
|
||||
|
||||
with patch.object(
|
||||
indieauth, "fetch_redirect_uris", side_effect=lambda *_: mock_coro([])
|
||||
):
|
||||
with patch.object(indieauth, "fetch_redirect_uris", return_value=[]):
|
||||
# Different domain
|
||||
assert not await indieauth.verify_redirect_uri(
|
||||
None, "http://ex.com", "http://different.com/callback"
|
||||
|
@ -174,9 +171,7 @@ async def test_find_link_tag_max_size(hass, mock_session):
|
|||
)
|
||||
async def test_verify_redirect_uri_android_ios(client_id):
|
||||
"""Test that we verify redirect uri correctly for Android/iOS."""
|
||||
with patch.object(
|
||||
indieauth, "fetch_redirect_uris", side_effect=lambda *_: mock_coro([])
|
||||
):
|
||||
with patch.object(indieauth, "fetch_redirect_uris", return_value=[]):
|
||||
assert await indieauth.verify_redirect_uri(
|
||||
None, client_id, "homeassistant://auth-callback"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue