diff --git a/Makefile b/Makefile index 899b6a59..80eb46cc 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PIPENV_RUN := pipenv run MONGODB_CONTAINER_NAME := fastapi-users-test-mongo isort-src: - $(PIPENV_RUN) isort ./fastapi_users + $(PIPENV_RUN) isort ./fastapi_users ./tests isort-docs: $(PIPENV_RUN) isort ./docs/src -o fastapi_users diff --git a/tests/conftest.py b/tests/conftest.py index 6ebd5dd0..6f4e87bb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ from typing import AsyncGenerator, List, Optional import httpx import pytest from asgi_lifespan import LifespanManager -from fastapi import Depends, Response, FastAPI +from fastapi import Depends, FastAPI, Response from fastapi.security import OAuth2PasswordBearer from httpx_oauth.oauth2 import OAuth2 from pydantic import UUID4 diff --git a/tests/test_authentication.py b/tests/test_authentication.py index d1e9ce69..7c52952d 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -4,10 +4,7 @@ import pytest from fastapi import Request, status from fastapi.security.base import SecurityBase -from fastapi_users.authentication import ( - BaseAuthentication, - DuplicateBackendNamesError, -) +from fastapi_users.authentication import BaseAuthentication, DuplicateBackendNamesError from fastapi_users.db import BaseUserDatabase from fastapi_users.models import BaseUserDB diff --git a/tests/test_db_mongodb.py b/tests/test_db_mongodb.py index eb8d3351..02ecdc12 100644 --- a/tests/test_db_mongodb.py +++ b/tests/test_db_mongodb.py @@ -1,8 +1,8 @@ from typing import AsyncGenerator import motor.motor_asyncio -import pytest import pymongo.errors +import pytest from fastapi_users.db.mongodb import MongoDBUserDatabase from fastapi_users.password import get_password_hash diff --git a/tests/test_db_tortoise.py b/tests/test_db_tortoise.py index 7bd9dc26..cf2c1b1a 100644 --- a/tests/test_db_tortoise.py +++ b/tests/test_db_tortoise.py @@ -1,8 +1,8 @@ from typing import AsyncGenerator import pytest -from tortoise.exceptions import IntegrityError from tortoise import Tortoise, fields +from tortoise.exceptions import IntegrityError from fastapi_users.db.tortoise import ( TortoiseBaseOAuthAccountModel, diff --git a/tests/test_fastapi_users.py b/tests/test_fastapi_users.py index d7d2f290..dfe8b913 100644 --- a/tests/test_fastapi_users.py +++ b/tests/test_fastapi_users.py @@ -1,11 +1,11 @@ from typing import AsyncGenerator -import pytest import httpx +import pytest from fastapi import Depends, FastAPI, status from fastapi_users import FastAPIUsers -from tests.conftest import User, UserCreate, UserUpdate, UserDB +from tests.conftest import User, UserCreate, UserDB, UserUpdate @pytest.fixture diff --git a/tests/test_router_auth.py b/tests/test_router_auth.py index 0fbac977..9f8c49d5 100644 --- a/tests/test_router_auth.py +++ b/tests/test_router_auth.py @@ -1,4 +1,4 @@ -from typing import AsyncGenerator, cast, Dict, Any +from typing import Any, AsyncGenerator, Dict, cast import httpx import pytest diff --git a/tests/test_router_oauth.py b/tests/test_router_oauth.py index f6d52565..64f83af9 100644 --- a/tests/test_router_oauth.py +++ b/tests/test_router_oauth.py @@ -1,17 +1,16 @@ +from typing import Any, AsyncGenerator, Dict, cast from unittest.mock import MagicMock -from typing import AsyncGenerator, Dict, Any, cast import asynctest import httpx import pytest -from fastapi import FastAPI, status, Request +from fastapi import FastAPI, Request, status from fastapi_users.authentication import Authenticator from fastapi_users.router.common import ErrorCode from fastapi_users.router.oauth import generate_state_token, get_oauth_router from tests.conftest import MockAuthentication, UserDB - SECRET = "SECRET" diff --git a/tests/test_router_register.py b/tests/test_router_register.py index f993bf40..efaddbba 100644 --- a/tests/test_router_register.py +++ b/tests/test_router_register.py @@ -1,10 +1,10 @@ -from typing import AsyncGenerator, cast, Dict, Any +from typing import Any, AsyncGenerator, Dict, cast from unittest.mock import MagicMock import asynctest import httpx import pytest -from fastapi import FastAPI, status, Request +from fastapi import FastAPI, Request, status from fastapi_users.router import ErrorCode, get_register_router from tests.conftest import User, UserCreate, UserDB diff --git a/tests/test_router_reset.py b/tests/test_router_reset.py index ab95d8f1..e533f925 100644 --- a/tests/test_router_reset.py +++ b/tests/test_router_reset.py @@ -1,11 +1,11 @@ -from typing import AsyncGenerator, cast, Dict, Any +from typing import Any, AsyncGenerator, Dict, cast from unittest.mock import MagicMock import asynctest import httpx import jwt import pytest -from fastapi import FastAPI, status, Request +from fastapi import FastAPI, Request, status from fastapi_users.router import ErrorCode, get_reset_password_router from fastapi_users.utils import JWT_ALGORITHM, generate_jwt diff --git a/tests/test_router_users.py b/tests/test_router_users.py index 88d12d98..ffe1f99c 100644 --- a/tests/test_router_users.py +++ b/tests/test_router_users.py @@ -1,14 +1,14 @@ -from typing import AsyncGenerator, cast, Dict, Any +from typing import Any, AsyncGenerator, Dict, cast from unittest.mock import MagicMock import asynctest import httpx import pytest -from fastapi import FastAPI, status, Request +from fastapi import FastAPI, Request, status from fastapi_users.authentication import Authenticator from fastapi_users.router import get_users_router -from tests.conftest import MockAuthentication, User, UserUpdate, UserDB +from tests.conftest import MockAuthentication, User, UserDB, UserUpdate SECRET = "SECRET" LIFETIME = 3600