-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate tests for sync client
- Loading branch information
Showing
9 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import pytest | ||
|
||
from gotrue import SyncGoTrueClient | ||
from gotrue.common.types import Provider | ||
|
||
client = SyncGoTrueClient(auto_refresh_token=False, persist_session=False) | ||
|
||
|
||
@pytest.mark.asyncio | ||
def test_sign_in_with_provider(): | ||
response = client.sign_in(provider=Provider.google) | ||
assert isinstance(response, str) | ||
|
||
|
||
@pytest.mark.asyncio | ||
def test_sign_in_with_provider_can_append_a_redirect_url(): | ||
response = client.sign_in( | ||
provider=Provider.google, | ||
redirect_to="https://localhost:9000/welcome", | ||
) | ||
assert isinstance(response, str) | ||
|
||
|
||
@pytest.mark.asyncio | ||
def test_sign_in_with_provider_can_append_scopes(): | ||
response = client.sign_in(provider=Provider.google, scopes="repo") | ||
assert isinstance(response, str) | ||
|
||
|
||
@pytest.mark.asyncio | ||
def test_sign_in_with_provider_can_append_multiple_options(): | ||
response = client.sign_in( | ||
provider=Provider.google, | ||
redirect_to="https://localhost:9000/welcome", | ||
scopes="repo", | ||
) | ||
assert isinstance(response, str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
|
||
from gotrue import SyncGoTrueClient | ||
|
||
client = SyncGoTrueClient() | ||
|
||
subscription = client.on_auth_state_change(lambda _, __: print("Auth state changed")) | ||
|
||
|
||
def test_subscribe_a_listener(): | ||
assert len(client.state_change_emitters) | ||
|
||
|
||
@pytest.mark.depends(on=[test_subscribe_a_listener.__name__]) | ||
def test_unsubscribe_a_listener(): | ||
subscription.unsubscribe() | ||
assert not len(client.state_change_emitters) |