mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[Admin] Code prettification and bugfixing (#3250)
* Facelift for Admin * Remove unnecessary converter, reorder existing steps * Delete admin.py * Delete __init__.py * Delete test_admin.py * Remove one extra unneeded check * Create 3250.bugfix.1.rst * Create 3250.bugfix.2.rst * Create 3250.bugfix.3.rst * Create 3250.bugfix.4.rst * Create 3250.misc.1.rst * Create 3250.misc.2.rst * Create 3250.misc.3.rst * Create 3250.breaking.1.rst * Create 3250.breaking.2.rst * ... * I hate black...
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from redbot.pytest.admin import *
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_serverlock_check(admin, coroutine):
|
||||
await admin.conf.serverlocked.set(True)
|
||||
guild = MagicMock()
|
||||
guild.leave = coroutine
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
ret = await admin._serverlock_check(guild)
|
||||
|
||||
assert ret is True
|
||||
|
||||
|
||||
def test_announcer_initial_state(announcer):
|
||||
assert announcer.active is None
|
||||
|
||||
|
||||
def test_announcer_start(announcer):
|
||||
announcer.announcer = object
|
||||
announcer.start()
|
||||
|
||||
assert announcer.ctx.bot.loop.create_task.called
|
||||
assert announcer.active is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_announcer_ignore(announcer, empty_guild, empty_channel):
|
||||
await announcer.config.guild(empty_guild).announce_channel.set(empty_channel.id)
|
||||
|
||||
guild = MagicMock()
|
||||
guild.id = empty_guild.id
|
||||
|
||||
guild.get_channel.return_value = empty_channel
|
||||
|
||||
ret = await announcer._get_announce_channel(guild)
|
||||
|
||||
assert guild.get_channel.called
|
||||
assert ret == empty_channel
|
||||
Reference in New Issue
Block a user