Move the cogs into a subdir
This commit is contained in:
parent
93337ebde9
commit
d3cdec3965
6 changed files with 4 additions and 4 deletions
34
py/cogs/owner_cog_test.py
Normal file
34
py/cogs/owner_cog_test.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import discord
|
||||
import discord.ext.commands as commands
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import discord.ext.test as dpytest
|
||||
|
||||
from owner_cog import OwnerCog
|
||||
|
||||
# Primarily borrowing from https://dpytest.readthedocs.io/en/latest/tutorials/using_pytest.html
|
||||
# TODO: Test more somehow, though it seems like dpytest is pretty incomplete
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def bot():
|
||||
# Setup
|
||||
intents = discord.Intents.default()
|
||||
intents.members = True
|
||||
intents.message_content = True
|
||||
b = commands.Bot(command_prefix="$",
|
||||
intents=intents)
|
||||
await b._async_setup_hook()
|
||||
await b.add_cog(OwnerCog(b))
|
||||
dpytest.configure(b)
|
||||
yield b
|
||||
await dpytest.empty_queue()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_must_be_owner(bot):
|
||||
with pytest.raises(commands.errors.NotOwner):
|
||||
await dpytest.message("$sync")
|
||||
|
||||
with pytest.raises(commands.errors.NotOwner):
|
||||
await dpytest.message("$close")
|
Loading…
Add table
Add a link
Reference in a new issue