Skip to content

Commit

Permalink
ensuring tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
fedden committed Feb 13, 2021
1 parent 2b74646 commit 337746c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gotrue/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def refresh_session(self) -> Dict[str, Any]:
if self.current_session is None or "access_token" not in self.current_session:
raise ValueError("Not logged in.")
self._call_refresh_token()
data = self.api.get_user(self.current_session.access_token)
data = self.api.get_user(self.current_session["access_token"])
self.current_user = data
return data

Expand Down Expand Up @@ -218,7 +218,7 @@ def _call_refresh_token(self, refresh_token: Optional[str] = None):
data = self.api.refresh_access_token(refresh_token)
if "access_token" in data:
self.current_session = data
self.current_user = data.user
self.current_user = data["user"]
self._notify_all_subscribers("SIGNED_IN")
token_expiry_seconds: int = data["expires_in"]
if self.auto_refresh_token and token_expiry_seconds is not None:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_gotrue.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_get_user_and_session_methods(client):
assert client.session() is not None


def test_refresh_session():
def test_refresh_session(client):
"""Test user can signup/in and refresh their session."""
# Create a random user.
random_email: str = f"{_random_string(10)}@supamail.com"
Expand All @@ -75,8 +75,8 @@ def test_refresh_session():
assert client.current_user is not None
assert client.current_session is not None
# Refresh users session
user = client.refresh_session()
_assert_authenticated_user(user)
data = client.refresh_session()
assert data["status_code"] == 200
assert client.current_user is not None
assert client.current_session is not None

Expand Down

0 comments on commit 337746c

Please sign in to comment.