[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:
Flame442
2020-01-02 09:11:27 -05:00
committed by Michael H
parent 36e2cde04d
commit e776b5ca1a
14 changed files with 164 additions and 199 deletions

View File

@@ -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