Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
takos22 committed Nov 19, 2023
1 parent 0efa19e commit 27e5cbb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
25 changes: 13 additions & 12 deletions tests/async/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,33 +176,34 @@ async def test_client_create_private_clash_of_code(


async def test_client_create_private_clash_of_code_logged_in_error(
client: AsyncClient,
client: AsyncClient, mock_httperror
):
with pytest.raises(exceptions.LoginRequired):
await client.create_private_clash_of_code(
["Python3"], ["SHORTEST", "FASTEST"]
)


async def test_client_create_private_clash_of_code_value_error(
auth_client: AsyncClient, mock_httperror
):
with pytest.raises(ValueError):
await auth_client.create_private_clash_of_code(
["Python3"], ["BAD MODE", "FASTEST"]
)

client._state.logged_in = True
mock_httperror(
auth_client._state.http,
client._state.http,
"create_private_clash_of_code",
{"id": 501, "message": "You need to be logged to perform this action."},
)
with pytest.raises(exceptions.LoginRequired):
await auth_client.create_private_clash_of_code(
await client.create_private_clash_of_code(

Check failure on line 193 in tests/async/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'

Check failure on line 193 in tests/async/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'

Check failure on line 193 in tests/async/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'
["Python3"], ["SHORTEST", "FASTEST"]

Check failure on line 194 in tests/async/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.7)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'
)


async def test_client_create_private_clash_of_code_value_error(
auth_client: AsyncClient,
):
with pytest.raises(ValueError):
await auth_client.create_private_clash_of_code(
["Python3"], ["BAD MODE", "FASTEST"]
)


async def test_client_join_private_clash_of_code(
auth_client: AsyncClient, private_clash: ClashOfCode, mock_http
):
Expand Down
23 changes: 12 additions & 11 deletions tests/sync/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,24 @@ def test_client_create_private_clash_of_code(


def test_client_create_private_clash_of_code_logged_in_error(
client: SyncClient,
client: SyncClient, mock_httperror
):
with pytest.raises(exceptions.LoginRequired):
client.create_private_clash_of_code(
["Python3"], ["SHORTEST", "FASTEST"]
)

client._state.logged_in = True
mock_httperror(
client._state.http,
"create_private_clash_of_code",
{"id": 501, "message": "You need to be logged to perform this action."},
)
with pytest.raises(exceptions.LoginRequired):
client.create_private_clash_of_code(

Check failure on line 182 in tests/sync/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'

Check failure on line 182 in tests/sync/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'

Check failure on line 182 in tests/sync/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'
["Python3"], ["SHORTEST", "FASTEST"]

Check failure on line 183 in tests/sync/test_client.py

View workflow job for this annotation

GitHub Actions / build (3.7)

test_client_create_private_clash_of_code_logged_in_error AttributeError: 'NoneType' object has no attribute 'id'
)


def test_client_create_private_clash_of_code_value_error(
auth_client: SyncClient, mock_httperror
Expand All @@ -181,16 +192,6 @@ def test_client_create_private_clash_of_code_value_error(
["Python3"], ["BAD MODE", "FASTEST"]
)

mock_httperror(
auth_client._state.http,
"create_private_clash_of_code",
{"id": 501, "message": "You need to be logged to perform this action."},
)
with pytest.raises(exceptions.LoginRequired):
auth_client.create_private_clash_of_code(
["Python3"], ["SHORTEST", "FASTEST"]
)


def test_client_join_private_clash_of_code(
auth_client: SyncClient, private_clash: ClashOfCode, mock_http
Expand Down

0 comments on commit 27e5cbb

Please sign in to comment.