Skip to content

Commit

Permalink
fix: change Api by API
Browse files Browse the repository at this point in the history
  • Loading branch information
leynier committed Nov 3, 2021
1 parent b16356d commit 13cc086
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions gotrue/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
__version__ = "0.2.0"

from ._async.api import AsyncGoTrueApi # noqa: F401
from ._async.api import AsyncGoTrueAPI # noqa: F401
from ._async.client import AsyncGoTrueClient # noqa: F401
from ._async.storage import AsyncMemoryStorage, AsyncSupportedStorage # noqa: F401
from ._sync.api import SyncGoTrueApi # noqa: F401
from ._sync.api import SyncGoTrueAPI # noqa: F401
from ._sync.client import SyncGoTrueClient # noqa: F401
from ._sync.storage import SyncMemoryStorage, SyncSupportedStorage # noqa: F401
from .types import * # noqa: F401, F403

Client = SyncGoTrueClient
GoTrueApi = SyncGoTrueApi
GoTrueAPI = SyncGoTrueAPI
4 changes: 2 additions & 2 deletions gotrue/_async/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..types import CookieOptions, LinkType, Provider, Session, User, UserAttributes


class AsyncGoTrueApi:
class AsyncGoTrueAPI:
def __init__(
self,
*,
Expand All @@ -21,7 +21,7 @@ def __init__(
self.cookie_options = cookie_options
self.http_client = AsyncClient()

async def __aenter__(self) -> AsyncGoTrueApi:
async def __aenter__(self) -> AsyncGoTrueAPI:
return self

async def __aexit__(self, exc_t, exc_v, exc_tb) -> None:
Expand Down
4 changes: 2 additions & 2 deletions gotrue/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
User,
UserAttributes,
)
from .api import AsyncGoTrueApi
from .api import AsyncGoTrueAPI
from .storage import AsyncMemoryStorage, AsyncSupportedStorage


Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(
self.auto_refresh_token = auto_refresh_token
self.persist_session = persist_session
self.local_storage = local_storage
self.api = AsyncGoTrueApi(
self.api = AsyncGoTrueAPI(
url=url,
headers=headers,
cookie_options=cookie_options,
Expand Down
4 changes: 2 additions & 2 deletions gotrue/_sync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..types import CookieOptions, LinkType, Provider, Session, User, UserAttributes


class SyncGoTrueApi:
class SyncGoTrueAPI:
def __init__(
self,
*,
Expand All @@ -21,7 +21,7 @@ def __init__(
self.cookie_options = cookie_options
self.http_client = SyncClient()

def __enter__(self) -> SyncGoTrueApi:
def __enter__(self) -> SyncGoTrueAPI:
return self

def __exit__(self, exc_t, exc_v, exc_tb) -> None:
Expand Down
4 changes: 2 additions & 2 deletions gotrue/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
User,
UserAttributes,
)
from .api import SyncGoTrueApi
from .api import SyncGoTrueAPI
from .storage import SyncMemoryStorage, SyncSupportedStorage


Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(
self.auto_refresh_token = auto_refresh_token
self.persist_session = persist_session
self.local_storage = local_storage
self.api = SyncGoTrueApi(
self.api = SyncGoTrueAPI(
url=url,
headers=headers,
cookie_options=cookie_options,
Expand Down
16 changes: 8 additions & 8 deletions tests/_async/test_api_with_auto_confirm_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from faker import Faker

from gotrue import AsyncGoTrueApi
from gotrue import AsyncGoTrueAPI
from gotrue.constants import COOKIE_OPTIONS
from gotrue.types import CookieOptions, LinkType, User

Expand All @@ -12,8 +12,8 @@


@pytest.fixture(name="api")
async def create_api() -> AsyncIterable[AsyncGoTrueApi]:
async with AsyncGoTrueApi(
async def create_api() -> AsyncIterable[AsyncGoTrueAPI]:
async with AsyncGoTrueAPI(
url=GOTRUE_URL,
headers={"Authorization": f"Bearer {TOKEN}"},
cookie_options=CookieOptions.from_dict(COOKIE_OPTIONS),
Expand All @@ -28,7 +28,7 @@ async def create_api() -> AsyncIterable[AsyncGoTrueApi]:


@pytest.mark.asyncio
async def test_sign_up_with_email_and_password(api: AsyncGoTrueApi):
async def test_sign_up_with_email_and_password(api: AsyncGoTrueAPI):
try:
response = await api.sign_up_with_email(
email=email,
Expand All @@ -46,7 +46,7 @@ async def test_sign_up_with_email_and_password(api: AsyncGoTrueApi):


@pytest.mark.asyncio
async def test_generate_sign_up_link(api: AsyncGoTrueApi):
async def test_generate_sign_up_link(api: AsyncGoTrueAPI):
try:
response = await api.generate_link(
type=LinkType.signup,
Expand All @@ -64,7 +64,7 @@ async def test_generate_sign_up_link(api: AsyncGoTrueApi):


@pytest.mark.asyncio
async def test_generate_magic_link(api: AsyncGoTrueApi):
async def test_generate_magic_link(api: AsyncGoTrueAPI):
try:
response = await api.generate_link(
type=LinkType.magiclink,
Expand All @@ -77,7 +77,7 @@ async def test_generate_magic_link(api: AsyncGoTrueApi):


@pytest.mark.asyncio
async def test_generate_invite_link(api: AsyncGoTrueApi):
async def test_generate_invite_link(api: AsyncGoTrueAPI):
try:
response = await api.generate_link(
type=LinkType.invite,
Expand All @@ -91,7 +91,7 @@ async def test_generate_invite_link(api: AsyncGoTrueApi):

@pytest.mark.asyncio
@pytest.mark.depends(on=[test_sign_up_with_email_and_password.__name__])
async def test_generate_recovery_link(api: AsyncGoTrueApi):
async def test_generate_recovery_link(api: AsyncGoTrueAPI):
try:
response = await api.generate_link(
type=LinkType.recovery,
Expand Down
16 changes: 8 additions & 8 deletions tests/_sync/test_api_with_auto_confirm_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from faker import Faker

from gotrue import SyncGoTrueApi
from gotrue import SyncGoTrueAPI
from gotrue.constants import COOKIE_OPTIONS
from gotrue.types import CookieOptions, LinkType, User

Expand All @@ -12,8 +12,8 @@


@pytest.fixture(name="api")
def create_api() -> Iterable[SyncGoTrueApi]:
with SyncGoTrueApi(
def create_api() -> Iterable[SyncGoTrueAPI]:
with SyncGoTrueAPI(
url=GOTRUE_URL,
headers={"Authorization": f"Bearer {TOKEN}"},
cookie_options=CookieOptions.from_dict(COOKIE_OPTIONS),
Expand All @@ -28,7 +28,7 @@ def create_api() -> Iterable[SyncGoTrueApi]:


@pytest.mark.asyncio
def test_sign_up_with_email_and_password(api: SyncGoTrueApi):
def test_sign_up_with_email_and_password(api: SyncGoTrueAPI):
try:
response = api.sign_up_with_email(
email=email,
Expand All @@ -46,7 +46,7 @@ def test_sign_up_with_email_and_password(api: SyncGoTrueApi):


@pytest.mark.asyncio
def test_generate_sign_up_link(api: SyncGoTrueApi):
def test_generate_sign_up_link(api: SyncGoTrueAPI):
try:
response = api.generate_link(
type=LinkType.signup,
Expand All @@ -64,7 +64,7 @@ def test_generate_sign_up_link(api: SyncGoTrueApi):


@pytest.mark.asyncio
def test_generate_magic_link(api: SyncGoTrueApi):
def test_generate_magic_link(api: SyncGoTrueAPI):
try:
response = api.generate_link(
type=LinkType.magiclink,
Expand All @@ -77,7 +77,7 @@ def test_generate_magic_link(api: SyncGoTrueApi):


@pytest.mark.asyncio
def test_generate_invite_link(api: SyncGoTrueApi):
def test_generate_invite_link(api: SyncGoTrueAPI):
try:
response = api.generate_link(
type=LinkType.invite,
Expand All @@ -91,7 +91,7 @@ def test_generate_invite_link(api: SyncGoTrueApi):

@pytest.mark.asyncio
@pytest.mark.depends(on=[test_sign_up_with_email_and_password.__name__])
def test_generate_recovery_link(api: SyncGoTrueApi):
def test_generate_recovery_link(api: SyncGoTrueAPI):
try:
response = api.generate_link(
type=LinkType.recovery,
Expand Down

0 comments on commit 13cc086

Please sign in to comment.