Skip to content

Commit

Permalink
More test coverage, updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
lexicalunit committed May 10, 2024
1 parent cabdb9f commit ab02f27
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Updated python dependencies.
- More test coverage.

## [v11.0.3](https://github.com/lexicalunit/spellbot/releases/tag/v11.0.3) - 2024-05-08

### Fixed
Expand Down
42 changes: 21 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions tests/actions/test_lfg_actions.py
@@ -1,15 +1,20 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from unittest.mock import AsyncMock

import pytest
import pytest_asyncio
from spellbot.actions import LookingForGameAction
from spellbot.enums import GameFormat, GameService

from tests.mocks import mock_discord_object

if TYPE_CHECKING:
import discord
from pytest_mock import MockerFixture
from spellbot import SpellBot
from spellbot.models import User


@pytest_asyncio.fixture
Expand Down Expand Up @@ -41,3 +46,22 @@ async def test_get_format_fallback_channel_data(self, action: LookingForGameActi
async def test_get_format_fallback_default(self, action: LookingForGameAction) -> None:
action.channel_data["default_format"] = None # type: ignore
assert await action.get_format(None) == GameFormat.COMMANDER.value

async def test_execute_in_non_guild_channel(
self,
action: LookingForGameAction,
mocker: MockerFixture,
user: User,
) -> None:
discord_user = mock_discord_object(user)
mocker.patch.object(action, "guild", None)
mocker.patch.object(action.interaction, "user", discord_user)
stub = mocker.patch("spellbot.actions.lfg_action.safe_send_user", AsyncMock())

result = await action.execute()

assert result is None
stub.assert_called_once_with(
discord_user,
"Sorry, that command is not supported in this context.",
)

0 comments on commit ab02f27

Please sign in to comment.