sort imports according to PEP8 for auth (#29619)
This commit is contained in:
parent
fa00808f6c
commit
6ad3b6426a
7 changed files with 17 additions and 19 deletions
|
@ -114,31 +114,29 @@ Result will be a long-lived access token:
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.auth.models import (
|
from homeassistant.auth.models import (
|
||||||
User,
|
|
||||||
Credentials,
|
|
||||||
TOKEN_TYPE_LONG_LIVED_ACCESS_TOKEN,
|
TOKEN_TYPE_LONG_LIVED_ACCESS_TOKEN,
|
||||||
|
Credentials,
|
||||||
|
User,
|
||||||
)
|
)
|
||||||
from homeassistant.loader import bind_hass
|
|
||||||
from homeassistant.components import websocket_api
|
from homeassistant.components import websocket_api
|
||||||
from homeassistant.components.http import KEY_REAL_IP
|
from homeassistant.components.http import KEY_REAL_IP
|
||||||
from homeassistant.components.http.auth import async_sign_path
|
from homeassistant.components.http.auth import async_sign_path
|
||||||
from homeassistant.components.http.ban import log_invalid_auth
|
from homeassistant.components.http.ban import log_invalid_auth
|
||||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||||
from homeassistant.components.http.view import HomeAssistantView
|
from homeassistant.components.http.view import HomeAssistantView
|
||||||
from homeassistant.core import callback, HomeAssistant
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import indieauth
|
from . import indieauth, login_flow, mfa_setup_flow
|
||||||
from . import login_flow
|
|
||||||
from . import mfa_setup_flow
|
|
||||||
|
|
||||||
DOMAIN = "auth"
|
DOMAIN = "auth"
|
||||||
WS_TYPE_CURRENT_USER = "auth/current_user"
|
WS_TYPE_CURRENT_USER = "auth/current_user"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""Helpers to resolve client ID/secret."""
|
"""Helpers to resolve client ID/secret."""
|
||||||
import logging
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from ipaddress import ip_address
|
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from urllib.parse import urlparse, urljoin
|
from ipaddress import ip_address
|
||||||
|
import logging
|
||||||
|
from urllib.parse import urljoin, urlparse
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,13 @@ import voluptuous_serialize
|
||||||
from homeassistant import data_entry_flow
|
from homeassistant import data_entry_flow
|
||||||
from homeassistant.components.http import KEY_REAL_IP
|
from homeassistant.components.http import KEY_REAL_IP
|
||||||
from homeassistant.components.http.ban import (
|
from homeassistant.components.http.ban import (
|
||||||
process_wrong_login,
|
|
||||||
process_success_login,
|
|
||||||
log_invalid_auth,
|
log_invalid_auth,
|
||||||
|
process_success_login,
|
||||||
|
process_wrong_login,
|
||||||
)
|
)
|
||||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||||
from homeassistant.components.http.view import HomeAssistantView
|
from homeassistant.components.http.view import HomeAssistantView
|
||||||
|
|
||||||
from . import indieauth
|
from . import indieauth
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import voluptuous_serialize
|
||||||
|
|
||||||
from homeassistant import data_entry_flow
|
from homeassistant import data_entry_flow
|
||||||
from homeassistant.components import websocket_api
|
from homeassistant.components import websocket_api
|
||||||
from homeassistant.core import callback, HomeAssistant
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
WS_TYPE_SETUP_MFA = "auth/setup_mfa"
|
WS_TYPE_SETUP_MFA = "auth/setup_mfa"
|
||||||
SCHEMA_WS_SETUP_MFA = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
SCHEMA_WS_SETUP_MFA = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
||||||
|
|
|
@ -4,7 +4,6 @@ from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import ensure_auth_manager_loaded
|
from tests.common import ensure_auth_manager_loaded
|
||||||
|
|
||||||
|
|
||||||
BASE_CONFIG = [
|
BASE_CONFIG = [
|
||||||
{
|
{
|
||||||
"name": "Example",
|
"name": "Example",
|
||||||
|
|
|
@ -3,15 +3,15 @@ from datetime import timedelta
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.auth.models import Credentials
|
from homeassistant.auth.models import Credentials
|
||||||
|
from homeassistant.components import auth
|
||||||
from homeassistant.components.auth import RESULT_TYPE_USER
|
from homeassistant.components.auth import RESULT_TYPE_USER
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
from homeassistant.components import auth
|
|
||||||
|
|
||||||
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI, MockUser
|
|
||||||
|
|
||||||
from . import async_setup_auth
|
from . import async_setup_auth
|
||||||
|
|
||||||
|
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI, MockUser
|
||||||
|
|
||||||
|
|
||||||
async def test_login_new_user_and_trying_refresh_token(hass, aiohttp_client):
|
async def test_login_new_user_and_trying_refresh_token(hass, aiohttp_client):
|
||||||
"""Test logging in with new user and refreshing tokens."""
|
"""Test logging in with new user and refreshing tokens."""
|
||||||
|
|
|
@ -4,7 +4,7 @@ from homeassistant.auth import auth_manager_from_config
|
||||||
from homeassistant.components.auth import mfa_setup_flow
|
from homeassistant.components.auth import mfa_setup_flow
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockUser, CLIENT_ID, ensure_auth_manager_loaded
|
from tests.common import CLIENT_ID, MockUser, ensure_auth_manager_loaded
|
||||||
|
|
||||||
|
|
||||||
async def test_ws_setup_depose_mfa(hass, hass_ws_client):
|
async def test_ws_setup_depose_mfa(hass, hass_ws_client):
|
||||||
|
|
Loading…
Add table
Reference in a new issue