diff --git a/examples/facebook.py b/examples/facebook.py index 6fde292..7b81373 100644 --- a/examples/facebook.py +++ b/examples/facebook.py @@ -3,9 +3,7 @@ import os import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get from litestar_sso.sso.facebook import FacebookSSO diff --git a/examples/fitbit.py b/examples/fitbit.py index 7d6a52a..3555a1a 100644 --- a/examples/fitbit.py +++ b/examples/fitbit.py @@ -1,10 +1,10 @@ """Fitbit Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.fitbit import FitbitSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/generic.py b/examples/generic.py index d0a1817..e273f29 100644 --- a/examples/generic.py +++ b/examples/generic.py @@ -1,12 +1,12 @@ """This is an example usage of litestar-sso.""" -import uvicorn from typing import Any, Dict, Union + +import uvicorn from httpx import AsyncClient -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get from litestar.exceptions import HTTPException + from litestar_sso.sso.base import DiscoveryDocument, OpenID from litestar_sso.sso.generic import create_provider diff --git a/examples/github.py b/examples/github.py index 3c49ead..2a988b6 100644 --- a/examples/github.py +++ b/examples/github.py @@ -1,10 +1,10 @@ """Github Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.github import GithubSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/gitlab.py b/examples/gitlab.py index bfcb773..454abcd 100644 --- a/examples/gitlab.py +++ b/examples/gitlab.py @@ -1,10 +1,10 @@ """Github Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.gitlab import GitlabSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/google.py b/examples/google.py index 10c723a..fa75fc0 100644 --- a/examples/google.py +++ b/examples/google.py @@ -1,10 +1,10 @@ """Google Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.google import GoogleSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/kakao.py b/examples/kakao.py index 6518a11..1cec8d1 100644 --- a/examples/kakao.py +++ b/examples/kakao.py @@ -1,10 +1,10 @@ """Kakao Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.kakao import KakaoSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/line.py b/examples/line.py index eb75761..0281149 100644 --- a/examples/line.py +++ b/examples/line.py @@ -1,10 +1,10 @@ """Line Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.line import LineSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/linkedin.py b/examples/linkedin.py index 7aae398..668d3d7 100644 --- a/examples/linkedin.py +++ b/examples/linkedin.py @@ -1,10 +1,10 @@ """Github Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.linkedin import LinkedInSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/microsoft.py b/examples/microsoft.py index 0d62c5e..7fd71c2 100644 --- a/examples/microsoft.py +++ b/examples/microsoft.py @@ -1,10 +1,10 @@ """Microsoft Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.microsoft import MicrosoftSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/naver.py b/examples/naver.py index 6a8a538..87e31b4 100644 --- a/examples/naver.py +++ b/examples/naver.py @@ -1,10 +1,10 @@ """Naver Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.naver import NaverSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/notion.py b/examples/notion.py index 7b3e363..820ebaa 100644 --- a/examples/notion.py +++ b/examples/notion.py @@ -1,10 +1,10 @@ """Github Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.notion import NotionSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/seznam.py b/examples/seznam.py index 5e18988..1444b9e 100644 --- a/examples/seznam.py +++ b/examples/seznam.py @@ -1,10 +1,10 @@ """Seznam Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.seznam import SeznamSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/twitter.py b/examples/twitter.py index 2d20a98..3a641a3 100644 --- a/examples/twitter.py +++ b/examples/twitter.py @@ -1,10 +1,10 @@ """Twitter (X) Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.twitter import TwitterSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/examples/yandex.py b/examples/yandex.py index 28652f5..3ed11fd 100644 --- a/examples/yandex.py +++ b/examples/yandex.py @@ -1,10 +1,10 @@ """Yandex Login Example""" import os + import uvicorn -from litestar import Litestar -from litestar import Request -from litestar import get +from litestar import Litestar, Request, get + from litestar_sso.sso.yandex import YandexSSO CLIENT_ID = os.environ["CLIENT_ID"] diff --git a/litestar_sso/sso/base.py b/litestar_sso/sso/base.py index fcb141d..a415fef 100644 --- a/litestar_sso/sso/base.py +++ b/litestar_sso/sso/base.py @@ -9,10 +9,10 @@ import httpx import pydantic -from oauthlib.oauth2 import WebApplicationClient -from litestar.exceptions import HTTPException from litestar import Request +from litestar.exceptions import HTTPException from litestar.response import Redirect +from oauthlib.oauth2 import WebApplicationClient from litestar_sso.pkce import get_pkce_challenge_pair from litestar_sso.state import generate_random_state diff --git a/tests/test_base.py b/tests/test_base.py index 433a705..ca8a35a 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,6 +1,7 @@ # type: ignore import os + import pytest from utils import Request diff --git a/tests/test_openid_responses.py b/tests/test_openid_responses.py index c13b008..59a9864 100644 --- a/tests/test_openid_responses.py +++ b/tests/test_openid_responses.py @@ -1,18 +1,19 @@ +from typing import Any, Dict, Tuple, Type + import pytest -from litestar_sso.sso.base import OpenID, SSOBase -from typing import Dict, Type, Tuple, Any -from litestar_sso.sso.twitter import TwitterSSO +from litestar_sso.sso.base import OpenID, SSOBase +from litestar_sso.sso.facebook import FacebookSSO +from litestar_sso.sso.fitbit import FitbitSSO +from litestar_sso.sso.github import GithubSSO +from litestar_sso.sso.gitlab import GitlabSSO +from litestar_sso.sso.kakao import KakaoSSO +from litestar_sso.sso.line import LineSSO +from litestar_sso.sso.linkedin import LinkedInSSO +from litestar_sso.sso.microsoft import MicrosoftSSO from litestar_sso.sso.naver import NaverSSO from litestar_sso.sso.spotify import SpotifySSO -from litestar_sso.sso.microsoft import MicrosoftSSO -from litestar_sso.sso.linkedin import LinkedInSSO -from litestar_sso.sso.line import LineSSO -from litestar_sso.sso.kakao import KakaoSSO -from litestar_sso.sso.gitlab import GitlabSSO -from litestar_sso.sso.github import GithubSSO -from litestar_sso.sso.fitbit import FitbitSSO -from litestar_sso.sso.facebook import FacebookSSO +from litestar_sso.sso.twitter import TwitterSSO from litestar_sso.sso.yandex import YandexSSO sso_test_cases: Tuple[Tuple[Type[SSOBase], Dict[str, Any], OpenID], ...] = ( diff --git a/tests/test_providers.py b/tests/test_providers.py index 08f6ae5..4f48ab4 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -17,14 +17,14 @@ from litestar_sso.sso.google import GoogleSSO from litestar_sso.sso.kakao import KakaoSSO from litestar_sso.sso.line import LineSSO +from litestar_sso.sso.linkedin import LinkedInSSO from litestar_sso.sso.microsoft import MicrosoftSSO from litestar_sso.sso.naver import NaverSSO -from litestar_sso.sso.spotify import SpotifySSO from litestar_sso.sso.notion import NotionSSO -from litestar_sso.sso.linkedin import LinkedInSSO +from litestar_sso.sso.seznam import SeznamSSO +from litestar_sso.sso.spotify import SpotifySSO from litestar_sso.sso.twitter import TwitterSSO from litestar_sso.sso.yandex import YandexSSO -from litestar_sso.sso.seznam import SeznamSSO GenericProvider = create_provider( name="generic", diff --git a/tests/test_providers_individual.py b/tests/test_providers_individual.py index 2f0b17a..a1c74e5 100644 --- a/tests/test_providers_individual.py +++ b/tests/test_providers_individual.py @@ -1,4 +1,5 @@ import pytest + from litestar_sso import NotionSSO, OpenID, SSOLoginError