Skip to content

Commit 0a7da42

Browse files
author
Dani Reinón
committed
tests: remove subclient tests
1 parent a157f78 commit 0a7da42

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

Diff for: tests/test_client.py

+1-42
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
from __future__ import annotations
22

3-
import random
4-
import string
5-
from typing import TYPE_CHECKING, Any, Union
3+
from typing import Any
64

75
import pytest
8-
from gotrue import Session, User
9-
10-
if TYPE_CHECKING:
11-
from supabase import Client
12-
13-
14-
def _random_string(length: int = 10) -> str:
15-
"""Generate random string."""
16-
return "".join(random.choices(string.ascii_uppercase + string.digits, k=length))
17-
18-
19-
def _assert_authenticated_user(data: Union[Session, User, str, None]) -> None:
20-
"""Raise assertion error if user is not logged in correctly."""
21-
assert data is not None
22-
assert isinstance(data, Session)
23-
assert data.user is not None
24-
assert data.user.aud == "authenticated"
256

267

278
@pytest.mark.xfail(
@@ -34,25 +15,3 @@ def test_incorrect_values_dont_instanciate_client(url: Any, key: Any) -> None:
3415
from supabase import Client, create_client
3516

3617
_: Client = create_client(url, key)
37-
38-
39-
@pytest.mark.skip(reason="TO FIX: Session does not terminate with test included.")
40-
def test_client_auth(supabase: Client) -> None:
41-
"""Ensure we can create an auth user, and login with it."""
42-
# Create a random user login email and password.
43-
random_email = f"{_random_string(10)}@supamail.com"
44-
random_password = _random_string(20)
45-
# Sign up (and sign in).
46-
user = supabase.auth.sign_up(
47-
email=random_email,
48-
password=random_password,
49-
phone=None,
50-
)
51-
_assert_authenticated_user(user)
52-
# Sign out.
53-
supabase.auth.sign_out()
54-
assert supabase.auth.user() is None
55-
assert supabase.auth.session() is None
56-
# Sign in (explicitly this time).
57-
user = supabase.auth.sign_in(email=random_email, password=random_password)
58-
_assert_authenticated_user(user)

0 commit comments

Comments
 (0)