Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
minimike86 committed Dec 22, 2024
1 parent fa789d8 commit 10a109f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aws/tests/test_store_oauth_authorize_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_validate_token_exception(mocker):
def test_store_in_dynamodb_update_item_where_item_already_exists(
set_environment_variables,
):
from store_oauth_authorize_code import store_in_dynamodb
from aws.lambdas.store_oauth_authorize_code import store_in_dynamodb

# Insert an initial item into the table
mock_dynamodb = boto3.resource("dynamodb")
Expand Down
14 changes: 6 additions & 8 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import boto3
import pytest
from moto import mock_aws
from twitchio import BroadcasterTypeEnum, UserTypeEnum
from twitchio import BroadcasterTypeEnum, UserTypeEnum, AuthenticationError

from twitchrce.config import bot_config

Expand Down Expand Up @@ -260,7 +260,7 @@ def test_setup_bot_if_bot_user_has_no_access_token_should_raise_value_error(
mock_get_item.return_value = {"Item": db_item_with_missing_access_token}

with pytest.raises(
ValueError, match="Bot has no access_token. Authenticate to update your token!"
AuthenticationError, match="Invalid or unauthorized Access Token passed."
):
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(setup_bot())
Expand Down Expand Up @@ -298,10 +298,7 @@ def test_setup_bot_if_db_has_no_bot_user_should_raise_value_error(mocker):
Key={"id": BOT_CONFIG.get("twitch").get("bot_user_id")}
)

with pytest.raises(
ValueError,
match="Bot user is not in the database. Authenticate to get an access token!",
):
with pytest.raises((RuntimeError, ValueError)):
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(setup_bot())

Expand Down Expand Up @@ -366,5 +363,6 @@ def test_setup_bot_if_bot_user_has_access_token_but_describe_instances_has_no_re
)
mock_check_valid_token.return_value = True

event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(setup_bot())
with pytest.raises((RuntimeError, ValueError, TypeError)):
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(setup_bot())

0 comments on commit 10a109f

Please sign in to comment.