Enable Ruff PT013 (#86757)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
bd9a8ba6f1
commit
e4a78420b8
50 changed files with 528 additions and 504 deletions
|
@ -4,7 +4,7 @@ import time
|
|||
from unittest.mock import patch
|
||||
|
||||
from httplib2 import Response
|
||||
from pytest import fixture
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.application_credentials import (
|
||||
ClientCredential,
|
||||
|
@ -33,13 +33,13 @@ TITLE = "example@gmail.com"
|
|||
TOKEN = "homeassistant.components.google_mail.api.config_entry_oauth2_flow.OAuth2Session.async_ensure_token_valid"
|
||||
|
||||
|
||||
@fixture(name="scopes")
|
||||
@pytest.fixture(name="scopes")
|
||||
def mock_scopes() -> list[str]:
|
||||
"""Fixture to set the scopes present in the OAuth token."""
|
||||
return SCOPES
|
||||
|
||||
|
||||
@fixture(autouse=True)
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_credentials(hass: HomeAssistant) -> None:
|
||||
"""Fixture to setup credentials."""
|
||||
assert await async_setup_component(hass, "application_credentials", {})
|
||||
|
@ -51,13 +51,13 @@ async def setup_credentials(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
|
||||
@fixture(name="expires_at")
|
||||
@pytest.fixture(name="expires_at")
|
||||
def mock_expires_at() -> int:
|
||||
"""Fixture to set the oauth token expiration time."""
|
||||
return time.time() + 3600
|
||||
|
||||
|
||||
@fixture(name="config_entry")
|
||||
@pytest.fixture(name="config_entry")
|
||||
def mock_config_entry(expires_at: int, scopes: list[str]) -> MockConfigEntry:
|
||||
"""Create Google Mail entry in Home Assistant."""
|
||||
return MockConfigEntry(
|
||||
|
@ -76,7 +76,7 @@ def mock_config_entry(expires_at: int, scopes: list[str]) -> MockConfigEntry:
|
|||
)
|
||||
|
||||
|
||||
@fixture(autouse=True)
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_connection(aioclient_mock: AiohttpClientMocker) -> None:
|
||||
"""Mock Google Mail connection."""
|
||||
aioclient_mock.post(
|
||||
|
@ -90,7 +90,7 @@ def mock_connection(aioclient_mock: AiohttpClientMocker) -> None:
|
|||
)
|
||||
|
||||
|
||||
@fixture(name="setup_integration")
|
||||
@pytest.fixture(name="setup_integration")
|
||||
async def mock_setup_integration(
|
||||
hass: HomeAssistant, config_entry: MockConfigEntry
|
||||
) -> Generator[ComponentSetup, None, None]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue