Skip to content

Commit

Permalink
fix(sdk): Remove instanceof check. Aligned structuring of tests with …
Browse files Browse the repository at this point in the history
…arrange, act, assert principle
  • Loading branch information
Lasse-numerous committed Oct 29, 2024
1 parent 631a55f commit 6c1e614
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions python/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ def test_user_collection_property_uses_user_id(
user = User(id=mock_id, name="John Doe", _client=mock_graphql_client)

assert user.collection is not None

assert user.collection.key == mock_key


def test_from_user_info_returns_user_with_correct_attributes(
mock_graphql_client: GraphQLClient,
) -> None:
user_info = {"user_id": mock_id, "name": "Jane Smith"}

user = User.from_user_info(user_info, _client=mock_graphql_client)

assert user.id == mock_id

assert user.name == "Jane Smith"
6 changes: 2 additions & 4 deletions python/tests/test_user_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def test_user_property_raises_value_error_when_no_cookie(
mock_graphql_client: GraphQLClient,
) -> None:
cg = CookieGetterStub({})

session = Session(cg, _client=mock_graphql_client)

with pytest.raises(
ValueError, match="Invalid user info in cookie or cookie is missing"
):
Expand All @@ -60,10 +62,6 @@ def test_user_property_returns_user_when_valid_cookie(

session = Session(cg, _client=mock_graphql_client)

assert isinstance(session.user, User)

assert session.user is not None

assert session.user.id == "1"

assert session.user.name == "Test User"

0 comments on commit 6c1e614

Please sign in to comment.