aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/backend/sync/__init__.py2
-rw-r--r--bot/cogs/backend/sync/_cog.py (renamed from bot/cogs/backend/sync/cog.py)6
-rw-r--r--bot/cogs/backend/sync/_syncers.py (renamed from bot/cogs/backend/sync/syncers.py)0
-rw-r--r--bot/cogs/moderation/__init__.py19
-rw-r--r--bot/cogs/moderation/incidents.py5
-rw-r--r--bot/cogs/moderation/infraction/_scheduler.py (renamed from bot/cogs/moderation/infraction/scheduler.py)22
-rw-r--r--bot/cogs/moderation/infraction/_utils.py (renamed from bot/cogs/moderation/infraction/utils.py)0
-rw-r--r--bot/cogs/moderation/infraction/infractions.py31
-rw-r--r--bot/cogs/moderation/infraction/management.py11
-rw-r--r--bot/cogs/moderation/infraction/superstarify.py29
-rw-r--r--bot/cogs/moderation/modlog.py5
-rw-r--r--bot/cogs/moderation/silence.py5
-rw-r--r--bot/cogs/moderation/watchchannels/__init__.py9
-rw-r--r--bot/cogs/moderation/watchchannels/_watchchannel.py (renamed from bot/cogs/moderation/watchchannels/watchchannel.py)0
-rw-r--r--bot/cogs/moderation/watchchannels/bigbrother.py9
-rw-r--r--bot/cogs/moderation/watchchannels/talentpool.py7
-rw-r--r--tests/bot/cogs/backend/sync/test_base.py2
-rw-r--r--tests/bot/cogs/backend/sync/test_cog.py15
-rw-r--r--tests/bot/cogs/backend/sync/test_roles.py2
-rw-r--r--tests/bot/cogs/backend/sync/test_users.py2
-rw-r--r--tests/bot/cogs/moderation/infraction/test_infractions.py6
21 files changed, 100 insertions, 87 deletions
diff --git a/bot/cogs/backend/sync/__init__.py b/bot/cogs/backend/sync/__init__.py
index fe7df4e9b..fb640a1cf 100644
--- a/bot/cogs/backend/sync/__init__.py
+++ b/bot/cogs/backend/sync/__init__.py
@@ -1,5 +1,5 @@
from bot.bot import Bot
-from .cog import Sync
+from ._cog import Sync
def setup(bot: Bot) -> None:
diff --git a/bot/cogs/backend/sync/cog.py b/bot/cogs/backend/sync/_cog.py
index 274845a50..b6068f328 100644
--- a/bot/cogs/backend/sync/cog.py
+++ b/bot/cogs/backend/sync/_cog.py
@@ -8,7 +8,7 @@ from discord.ext.commands import Cog, Context
from bot import constants
from bot.api import ResponseCodeError
from bot.bot import Bot
-from . import syncers
+from . import _syncers
log = logging.getLogger(__name__)
@@ -18,8 +18,8 @@ class Sync(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot
- self.role_syncer = syncers.RoleSyncer(self.bot)
- self.user_syncer = syncers.UserSyncer(self.bot)
+ self.role_syncer = _syncers.RoleSyncer(self.bot)
+ self.user_syncer = _syncers.UserSyncer(self.bot)
self.bot.loop.create_task(self.sync_guild())
diff --git a/bot/cogs/backend/sync/syncers.py b/bot/cogs/backend/sync/_syncers.py
index f7ba811bc..f7ba811bc 100644
--- a/bot/cogs/backend/sync/syncers.py
+++ b/bot/cogs/backend/sync/_syncers.py
diff --git a/bot/cogs/moderation/__init__.py b/bot/cogs/moderation/__init__.py
index aad1f3c26..e69de29bb 100644
--- a/bot/cogs/moderation/__init__.py
+++ b/bot/cogs/moderation/__init__.py
@@ -1,19 +0,0 @@
-from bot.bot import Bot
-from .incidents import Incidents
-from .infraction.infractions import Infractions
-from .infraction.management import ModManagement
-from .infraction.superstarify import Superstarify
-from .modlog import ModLog
-from .silence import Silence
-from .slowmode import Slowmode
-
-
-def setup(bot: Bot) -> None:
- """Load the Incidents, Infractions, ModManagement, ModLog, Silence, Slowmode and Superstarify cogs."""
- bot.add_cog(Incidents(bot))
- bot.add_cog(Infractions(bot))
- bot.add_cog(ModLog(bot))
- bot.add_cog(ModManagement(bot))
- bot.add_cog(Silence(bot))
- bot.add_cog(Slowmode(bot))
- bot.add_cog(Superstarify(bot))
diff --git a/bot/cogs/moderation/incidents.py b/bot/cogs/moderation/incidents.py
index 3605ab1d2..e49913552 100644
--- a/bot/cogs/moderation/incidents.py
+++ b/bot/cogs/moderation/incidents.py
@@ -405,3 +405,8 @@ class Incidents(Cog):
"""Pass `message` to `add_signals` if and only if it satisfies `is_incident`."""
if is_incident(message):
await add_signals(message)
+
+
+def setup(bot: Bot) -> None:
+ """Load the Incidents cog."""
+ bot.add_cog(Incidents(bot))
diff --git a/bot/cogs/moderation/infraction/scheduler.py b/bot/cogs/moderation/infraction/_scheduler.py
index b3d27fe76..33944a8db 100644
--- a/bot/cogs/moderation/infraction/scheduler.py
+++ b/bot/cogs/moderation/infraction/_scheduler.py
@@ -16,8 +16,8 @@ from bot.cogs.moderation.modlog import ModLog
from bot.constants import Colours, STAFF_CHANNELS
from bot.utils import time
from bot.utils.scheduling import Scheduler
-from . import utils
-from .utils import UserSnowflake
+from . import _utils
+from ._utils import UserSnowflake
log = logging.getLogger(__name__)
@@ -56,7 +56,7 @@ class InfractionScheduler:
async def reapply_infraction(
self,
- infraction: utils.Infraction,
+ infraction: _utils.Infraction,
apply_coro: t.Optional[t.Awaitable]
) -> None:
"""Reapply an infraction if it's still active or deactivate it if less than 60 sec left."""
@@ -80,13 +80,13 @@ class InfractionScheduler:
async def apply_infraction(
self,
ctx: Context,
- infraction: utils.Infraction,
+ infraction: _utils.Infraction,
user: UserSnowflake,
action_coro: t.Optional[t.Awaitable] = None
) -> None:
"""Apply an infraction to the user, log the infraction, and optionally notify the user."""
infr_type = infraction["type"]
- icon = utils.INFRACTION_ICONS[infr_type][0]
+ icon = _utils.INFRACTION_ICONS[infr_type][0]
reason = infraction["reason"]
expiry = time.format_infraction_with_duration(infraction["expires_at"])
id_ = infraction['id']
@@ -126,7 +126,7 @@ class InfractionScheduler:
log.error(f"Failed to DM {user.id}: could not fetch user (status {e.status})")
else:
# Accordingly display whether the user was successfully notified via DM.
- if await utils.notify_infraction(user, infr_type, expiry, reason, icon):
+ if await _utils.notify_infraction(user, infr_type, expiry, reason, icon):
dm_result = ":incoming_envelope: "
dm_log_text = "\nDM: Sent"
@@ -316,7 +316,7 @@ class InfractionScheduler:
# Send a log message to the mod log.
await self.mod_log.send_log_message(
- icon_url=utils.INFRACTION_ICONS[infr_type][1],
+ icon_url=_utils.INFRACTION_ICONS[infr_type][1],
colour=Colours.soft_green,
title=f"Infraction {log_title}: {infr_type}",
thumbnail=user.avatar_url_as(static_format="png"),
@@ -327,7 +327,7 @@ class InfractionScheduler:
async def deactivate_infraction(
self,
- infraction: utils.Infraction,
+ infraction: _utils.Infraction,
send_log: bool = True
) -> t.Dict[str, str]:
"""
@@ -432,7 +432,7 @@ class InfractionScheduler:
log.trace(f"Sending deactivation mod log for infraction #{id_}.")
await self.mod_log.send_log_message(
- icon_url=utils.INFRACTION_ICONS[type_][1],
+ icon_url=_utils.INFRACTION_ICONS[type_][1],
colour=Colours.soft_green,
title=f"Infraction {log_title}: {type_}",
thumbnail=avatar,
@@ -444,7 +444,7 @@ class InfractionScheduler:
return log_text
@abstractmethod
- async def _pardon_action(self, infraction: utils.Infraction) -> t.Optional[t.Dict[str, str]]:
+ async def _pardon_action(self, infraction: _utils.Infraction) -> t.Optional[t.Dict[str, str]]:
"""
Execute deactivation steps specific to the infraction's type and return a log dict.
@@ -452,7 +452,7 @@ class InfractionScheduler:
"""
raise NotImplementedError
- def schedule_expiration(self, infraction: utils.Infraction) -> None:
+ def schedule_expiration(self, infraction: _utils.Infraction) -> None:
"""
Marks an infraction expired after the delay from time of scheduling to time of expiration.
diff --git a/bot/cogs/moderation/infraction/utils.py b/bot/cogs/moderation/infraction/_utils.py
index fb55287b6..fb55287b6 100644
--- a/bot/cogs/moderation/infraction/utils.py
+++ b/bot/cogs/moderation/infraction/_utils.py
diff --git a/bot/cogs/moderation/infraction/infractions.py b/bot/cogs/moderation/infraction/infractions.py
index 8df642428..cb459b447 100644
--- a/bot/cogs/moderation/infraction/infractions.py
+++ b/bot/cogs/moderation/infraction/infractions.py
@@ -13,9 +13,9 @@ from bot.constants import Event
from bot.converters import Expiry, FetchedMember
from bot.decorators import respect_role_hierarchy
from bot.utils.checks import with_role_check
-from . import utils
-from .scheduler import InfractionScheduler
-from .utils import UserSnowflake
+from . import _utils
+from ._scheduler import InfractionScheduler
+from ._utils import UserSnowflake
log = logging.getLogger(__name__)
@@ -55,7 +55,7 @@ class Infractions(InfractionScheduler, commands.Cog):
@command()
async def warn(self, ctx: Context, user: Member, *, reason: t.Optional[str] = None) -> None:
"""Warn a user for the given reason."""
- infraction = await utils.post_infraction(ctx, user, "warning", reason, active=False)
+ infraction = await _utils.post_infraction(ctx, user, "warning", reason, active=False)
if infraction is None:
return
@@ -125,7 +125,7 @@ class Infractions(InfractionScheduler, commands.Cog):
@command(hidden=True)
async def note(self, ctx: Context, user: FetchedMember, *, reason: t.Optional[str] = None) -> None:
"""Create a private note for a user with the given reason without notifying the user."""
- infraction = await utils.post_infraction(ctx, user, "note", reason, hidden=True, active=False)
+ infraction = await _utils.post_infraction(ctx, user, "note", reason, hidden=True, active=False)
if infraction is None:
return
@@ -213,10 +213,10 @@ class Infractions(InfractionScheduler, commands.Cog):
async def apply_mute(self, ctx: Context, user: Member, reason: t.Optional[str], **kwargs) -> None:
"""Apply a mute infraction with kwargs passed to `post_infraction`."""
- if await utils.get_active_infraction(ctx, user, "mute"):
+ if await _utils.get_active_infraction(ctx, user, "mute"):
return
- infraction = await utils.post_infraction(ctx, user, "mute", reason, active=True, **kwargs)
+ infraction = await _utils.post_infraction(ctx, user, "mute", reason, active=True, **kwargs)
if infraction is None:
return
@@ -233,7 +233,7 @@ class Infractions(InfractionScheduler, commands.Cog):
@respect_role_hierarchy()
async def apply_kick(self, ctx: Context, user: Member, reason: t.Optional[str], **kwargs) -> None:
"""Apply a kick infraction with kwargs passed to `post_infraction`."""
- infraction = await utils.post_infraction(ctx, user, "kick", reason, active=False, **kwargs)
+ infraction = await _utils.post_infraction(ctx, user, "kick", reason, active=False, **kwargs)
if infraction is None:
return
@@ -254,7 +254,7 @@ class Infractions(InfractionScheduler, commands.Cog):
"""
# In the case of a permanent ban, we don't need get_active_infractions to tell us if one is active
is_temporary = kwargs.get("expires_at") is not None
- active_infraction = await utils.get_active_infraction(ctx, user, "ban", is_temporary)
+ active_infraction = await _utils.get_active_infraction(ctx, user, "ban", is_temporary)
if active_infraction:
if is_temporary:
@@ -269,7 +269,7 @@ class Infractions(InfractionScheduler, commands.Cog):
log.trace("Old tempban is being replaced by new permaban.")
await self.pardon_infraction(ctx, "ban", user, is_temporary)
- infraction = await utils.post_infraction(ctx, user, "ban", reason, active=True, **kwargs)
+ infraction = await _utils.post_infraction(ctx, user, "ban", reason, active=True, **kwargs)
if infraction is None:
return
@@ -309,11 +309,11 @@ class Infractions(InfractionScheduler, commands.Cog):
await user.remove_roles(self._muted_role, reason=reason)
# DM the user about the expiration.
- notified = await utils.notify_pardon(
+ notified = await _utils.notify_pardon(
user=user,
title="You have been unmuted",
content="You may now send messages in the server.",
- icon_url=utils.INFRACTION_ICONS["mute"][1]
+ icon_url=_utils.INFRACTION_ICONS["mute"][1]
)
log_text["Member"] = f"{user.mention}(`{user.id}`)"
@@ -339,7 +339,7 @@ class Infractions(InfractionScheduler, commands.Cog):
return log_text
- async def _pardon_action(self, infraction: utils.Infraction) -> t.Optional[t.Dict[str, str]]:
+ async def _pardon_action(self, infraction: _utils.Infraction) -> t.Optional[t.Dict[str, str]]:
"""
Execute deactivation steps specific to the infraction's type and return a log dict.
@@ -368,3 +368,8 @@ class Infractions(InfractionScheduler, commands.Cog):
if discord.User in error.converters or discord.Member in error.converters:
await ctx.send(str(error.errors[0]))
error.handled = True
+
+
+def setup(bot: Bot) -> None:
+ """Load the Infractions cog."""
+ bot.add_cog(Infractions(bot))
diff --git a/bot/cogs/moderation/infraction/management.py b/bot/cogs/moderation/infraction/management.py
index 791585b6e..9e7ae8113 100644
--- a/bot/cogs/moderation/infraction/management.py
+++ b/bot/cogs/moderation/infraction/management.py
@@ -14,7 +14,7 @@ from bot.converters import Expiry, InfractionSearchQuery, allowed_strings, proxy
from bot.pagination import LinePaginator
from bot.utils import time
from bot.utils.checks import in_whitelist_check, with_role_check
-from . import utils
+from . import _utils
from .infractions import Infractions
log = logging.getLogger(__name__)
@@ -220,7 +220,7 @@ class ModManagement(commands.Cog):
self,
ctx: Context,
embed: discord.Embed,
- infractions: t.Iterable[utils.Infraction]
+ infractions: t.Iterable[_utils.Infraction]
) -> None:
"""Send a paginated embed of infractions for the specified user."""
if not infractions:
@@ -241,7 +241,7 @@ class ModManagement(commands.Cog):
max_size=1000
)
- def infraction_to_string(self, infraction: utils.Infraction) -> str:
+ def infraction_to_string(self, infraction: _utils.Infraction) -> str:
"""Convert the infraction object to a string representation."""
actor_id = infraction["actor"]
guild = self.bot.get_guild(constants.Guild.id)
@@ -303,3 +303,8 @@ class ModManagement(commands.Cog):
if discord.User in error.converters:
await ctx.send(str(error.errors[0]))
error.handled = True
+
+
+def setup(bot: Bot) -> None:
+ """Load the ModManagement cog."""
+ bot.add_cog(ModManagement(bot))
diff --git a/bot/cogs/moderation/infraction/superstarify.py b/bot/cogs/moderation/infraction/superstarify.py
index 867de815a..7dc5b4691 100644
--- a/bot/cogs/moderation/infraction/superstarify.py
+++ b/bot/cogs/moderation/infraction/superstarify.py
@@ -13,8 +13,8 @@ from bot.bot import Bot
from bot.converters import Expiry
from bot.utils.checks import with_role_check
from bot.utils.time import format_infraction
-from . import utils
-from .scheduler import InfractionScheduler
+from . import _utils
+from ._scheduler import InfractionScheduler
log = logging.getLogger(__name__)
NICKNAME_POLICY_URL = "https://pythondiscord.com/pages/rules/#nickname-policy"
@@ -67,7 +67,7 @@ class Superstarify(InfractionScheduler, Cog):
reason=f"Superstarified member tried to escape the prison: {infraction['id']}"
)
- notified = await utils.notify_infraction(
+ notified = await _utils.notify_infraction(
user=after,
infr_type="Superstarify",
expires_at=format_infraction(infraction["expires_at"]),
@@ -76,7 +76,7 @@ class Superstarify(InfractionScheduler, Cog):
f"from **{before.display_name}** to **{after.display_name}**, but as you "
"are currently in superstar-prison, you do not have permission to do so."
),
- icon_url=utils.INFRACTION_ICONS["superstar"][0]
+ icon_url=_utils.INFRACTION_ICONS["superstar"][0]
)
if not notified:
@@ -130,12 +130,12 @@ class Superstarify(InfractionScheduler, Cog):
An optional reason can be provided. If no reason is given, the original name will be shown
in a generated reason.
"""
- if await utils.get_active_infraction(ctx, member, "superstar"):
+ if await _utils.get_active_infraction(ctx, member, "superstar"):
return
# Post the infraction to the API
reason = reason or f"old nick: {member.display_name}"
- infraction = await utils.post_infraction(ctx, member, "superstar", reason, duration, active=True)
+ infraction = await _utils.post_infraction(ctx, member, "superstar", reason, duration, active=True)
id_ = infraction["id"]
old_nick = member.display_name
@@ -149,11 +149,11 @@ class Superstarify(InfractionScheduler, Cog):
self.schedule_expiration(infraction)
# Send a DM to the user to notify them of their new infraction.
- await utils.notify_infraction(
+ await _utils.notify_infraction(
user=member,
infr_type="Superstarify",
expires_at=expiry_str,
- icon_url=utils.INFRACTION_ICONS["superstar"][0],
+ icon_url=_utils.INFRACTION_ICONS["superstar"][0],
reason=f"Your nickname didn't comply with our [nickname policy]({NICKNAME_POLICY_URL})."
)
@@ -176,7 +176,7 @@ class Superstarify(InfractionScheduler, Cog):
# Log to the mod log channel.
log.trace(f"Sending apply mod log for superstar #{id_}.")
await self.mod_log.send_log_message(
- icon_url=utils.INFRACTION_ICONS["superstar"][0],
+ icon_url=_utils.INFRACTION_ICONS["superstar"][0],
colour=Colour.gold(),
title="Member achieved superstardom",
thumbnail=member.avatar_url_as(static_format="png"),
@@ -196,7 +196,7 @@ class Superstarify(InfractionScheduler, Cog):
"""Remove the superstarify infraction and allow the user to change their nickname."""
await self.pardon_infraction(ctx, "superstar", member)
- async def _pardon_action(self, infraction: utils.Infraction) -> t.Optional[t.Dict[str, str]]:
+ async def _pardon_action(self, infraction: _utils.Infraction) -> t.Optional[t.Dict[str, str]]:
"""Pardon a superstar infraction and return a log dict."""
if infraction["type"] != "superstar":
return
@@ -213,11 +213,11 @@ class Superstarify(InfractionScheduler, Cog):
return {}
# DM the user about the expiration.
- notified = await utils.notify_pardon(
+ notified = await _utils.notify_pardon(
user=user,
title="You are no longer superstarified",
content="You may now change your nickname on the server.",
- icon_url=utils.INFRACTION_ICONS["superstar"][1]
+ icon_url=_utils.INFRACTION_ICONS["superstar"][1]
)
return {
@@ -237,3 +237,8 @@ class Superstarify(InfractionScheduler, Cog):
def cog_check(self, ctx: Context) -> bool:
"""Only allow moderators to invoke the commands in this cog."""
return with_role_check(ctx, *constants.MODERATION_ROLES)
+
+
+def setup(bot: Bot) -> None:
+ """Load the Superstarify cog."""
+ bot.add_cog(Superstarify(bot))
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py
index 0a63f57b8..c86f04b9d 100644
--- a/bot/cogs/moderation/modlog.py
+++ b/bot/cogs/moderation/modlog.py
@@ -830,3 +830,8 @@ class ModLog(Cog, name="ModLog"):
thumbnail=member.avatar_url_as(static_format="png"),
channel_id=Channels.voice_log
)
+
+
+def setup(bot: Bot) -> None:
+ """Load the ModLog cog."""
+ bot.add_cog(ModLog(bot))
diff --git a/bot/cogs/moderation/silence.py b/bot/cogs/moderation/silence.py
index f8a6592bc..4af87c724 100644
--- a/bot/cogs/moderation/silence.py
+++ b/bot/cogs/moderation/silence.py
@@ -163,3 +163,8 @@ class Silence(commands.Cog):
def cog_check(self, ctx: Context) -> bool:
"""Only allow moderators to invoke the commands in this cog."""
return with_role_check(ctx, *MODERATION_ROLES)
+
+
+def setup(bot: Bot) -> None:
+ """Load the Silence cog."""
+ bot.add_cog(Silence(bot))
diff --git a/bot/cogs/moderation/watchchannels/__init__.py b/bot/cogs/moderation/watchchannels/__init__.py
index 69d118df6..e69de29bb 100644
--- a/bot/cogs/moderation/watchchannels/__init__.py
+++ b/bot/cogs/moderation/watchchannels/__init__.py
@@ -1,9 +0,0 @@
-from bot.bot import Bot
-from .bigbrother import BigBrother
-from .talentpool import TalentPool
-
-
-def setup(bot: Bot) -> None:
- """Load the BigBrother and TalentPool cogs."""
- bot.add_cog(BigBrother(bot))
- bot.add_cog(TalentPool(bot))
diff --git a/bot/cogs/moderation/watchchannels/watchchannel.py b/bot/cogs/moderation/watchchannels/_watchchannel.py
index 044077350..044077350 100644
--- a/bot/cogs/moderation/watchchannels/watchchannel.py
+++ b/bot/cogs/moderation/watchchannels/_watchchannel.py
diff --git a/bot/cogs/moderation/watchchannels/bigbrother.py b/bot/cogs/moderation/watchchannels/bigbrother.py
index 0c72e88f7..7db34bcf2 100644
--- a/bot/cogs/moderation/watchchannels/bigbrother.py
+++ b/bot/cogs/moderation/watchchannels/bigbrother.py
@@ -5,11 +5,11 @@ from collections import ChainMap
from discord.ext.commands import Cog, Context, group
from bot.bot import Bot
-from bot.cogs.moderation.infraction.utils import post_infraction
+from bot.cogs.moderation.infraction._utils import post_infraction
from bot.constants import Channels, MODERATION_ROLES, Webhooks
from bot.converters import FetchedMember
from bot.decorators import with_role
-from .watchchannel import WatchChannel
+from ._watchchannel import WatchChannel
log = logging.getLogger(__name__)
@@ -163,3 +163,8 @@ class BigBrother(WatchChannel, Cog, name="Big Brother"):
message = ":x: The specified user is currently not being watched."
await ctx.send(message)
+
+
+def setup(bot: Bot) -> None:
+ """Load the BigBrother cog."""
+ bot.add_cog(BigBrother(bot))
diff --git a/bot/cogs/moderation/watchchannels/talentpool.py b/bot/cogs/moderation/watchchannels/talentpool.py
index 89256e92e..2972f56e1 100644
--- a/bot/cogs/moderation/watchchannels/talentpool.py
+++ b/bot/cogs/moderation/watchchannels/talentpool.py
@@ -12,7 +12,7 @@ from bot.converters import FetchedMember
from bot.decorators import with_role
from bot.pagination import LinePaginator
from bot.utils import time
-from .watchchannel import WatchChannel
+from ._watchchannel import WatchChannel
log = logging.getLogger(__name__)
@@ -262,3 +262,8 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"):
)
return lines.strip()
+
+
+def setup(bot: Bot) -> None:
+ """Load the TalentPool cog."""
+ bot.add_cog(TalentPool(bot))
diff --git a/tests/bot/cogs/backend/sync/test_base.py b/tests/bot/cogs/backend/sync/test_base.py
index 0d0a8299d..3009aacb6 100644
--- a/tests/bot/cogs/backend/sync/test_base.py
+++ b/tests/bot/cogs/backend/sync/test_base.py
@@ -6,7 +6,7 @@ import discord
from bot import constants
from bot.api import ResponseCodeError
-from bot.cogs.backend.sync.syncers import Syncer, _Diff
+from bot.cogs.backend.sync._syncers import Syncer, _Diff
from tests import helpers
diff --git a/tests/bot/cogs/backend/sync/test_cog.py b/tests/bot/cogs/backend/sync/test_cog.py
index 199747051..e40552817 100644
--- a/tests/bot/cogs/backend/sync/test_cog.py
+++ b/tests/bot/cogs/backend/sync/test_cog.py
@@ -6,7 +6,8 @@ import discord
from bot import constants
from bot.api import ResponseCodeError
from bot.cogs.backend import sync
-from bot.cogs.backend.sync.syncers import Syncer
+from bot.cogs.backend.sync._cog import Sync
+from bot.cogs.backend.sync._syncers import Syncer
from tests import helpers
from tests.base import CommandTestCase
@@ -29,19 +30,19 @@ class SyncCogTestCase(unittest.IsolatedAsyncioTestCase):
self.bot = helpers.MockBot()
self.role_syncer_patcher = mock.patch(
- "bot.cogs.backend.sync.syncers.RoleSyncer",
+ "bot.cogs.backend.sync._syncers.RoleSyncer",
autospec=Syncer,
spec_set=True
)
self.user_syncer_patcher = mock.patch(
- "bot.cogs.backend.sync.syncers.UserSyncer",
+ "bot.cogs.backend.sync._syncers.UserSyncer",
autospec=Syncer,
spec_set=True
)
self.RoleSyncer = self.role_syncer_patcher.start()
self.UserSyncer = self.user_syncer_patcher.start()
- self.cog = sync.Sync(self.bot)
+ self.cog = Sync(self.bot)
def tearDown(self):
self.role_syncer_patcher.stop()
@@ -59,7 +60,7 @@ class SyncCogTestCase(unittest.IsolatedAsyncioTestCase):
class SyncCogTests(SyncCogTestCase):
"""Tests for the Sync cog."""
- @mock.patch.object(sync.Sync, "sync_guild", new_callable=mock.MagicMock)
+ @mock.patch.object(Sync, "sync_guild", new_callable=mock.MagicMock)
def test_sync_cog_init(self, sync_guild):
"""Should instantiate syncers and run a sync for the guild."""
# Reset because a Sync cog was already instantiated in setUp.
@@ -70,7 +71,7 @@ class SyncCogTests(SyncCogTestCase):
mock_sync_guild_coro = mock.MagicMock()
sync_guild.return_value = mock_sync_guild_coro
- sync.Sync(self.bot)
+ Sync(self.bot)
self.RoleSyncer.assert_called_once_with(self.bot)
self.UserSyncer.assert_called_once_with(self.bot)
@@ -131,7 +132,7 @@ class SyncCogListenerTests(SyncCogTestCase):
super().setUp()
self.cog.patch_user = mock.AsyncMock(spec_set=self.cog.patch_user)
- self.guild_id_patcher = mock.patch("bot.cogs.backend.sync.cog.constants.Guild.id", 5)
+ self.guild_id_patcher = mock.patch("bot.cogs.backend.sync._cog.constants.Guild.id", 5)
self.guild_id = self.guild_id_patcher.start()
self.guild = helpers.MockGuild(id=self.guild_id)
diff --git a/tests/bot/cogs/backend/sync/test_roles.py b/tests/bot/cogs/backend/sync/test_roles.py
index cc2e51c7f..99d682ede 100644
--- a/tests/bot/cogs/backend/sync/test_roles.py
+++ b/tests/bot/cogs/backend/sync/test_roles.py
@@ -3,7 +3,7 @@ from unittest import mock
import discord
-from bot.cogs.backend.sync.syncers import RoleSyncer, _Diff, _Role
+from bot.cogs.backend.sync._syncers import RoleSyncer, _Diff, _Role
from tests import helpers
diff --git a/tests/bot/cogs/backend/sync/test_users.py b/tests/bot/cogs/backend/sync/test_users.py
index 490ea9e06..51dcbe48a 100644
--- a/tests/bot/cogs/backend/sync/test_users.py
+++ b/tests/bot/cogs/backend/sync/test_users.py
@@ -1,7 +1,7 @@
import unittest
from unittest import mock
-from bot.cogs.backend.sync.syncers import UserSyncer, _Diff, _User
+from bot.cogs.backend.sync._syncers import UserSyncer, _Diff, _User
from tests import helpers
diff --git a/tests/bot/cogs/moderation/infraction/test_infractions.py b/tests/bot/cogs/moderation/infraction/test_infractions.py
index a79042557..2df61d431 100644
--- a/tests/bot/cogs/moderation/infraction/test_infractions.py
+++ b/tests/bot/cogs/moderation/infraction/test_infractions.py
@@ -17,8 +17,8 @@ class TruncationTests(unittest.IsolatedAsyncioTestCase):
self.guild = MockGuild(id=4567)
self.ctx = MockContext(bot=self.bot, author=self.user, guild=self.guild)
- @patch("bot.cogs.moderation.infraction.utils.get_active_infraction")
- @patch("bot.cogs.moderation.infraction.utils.post_infraction")
+ @patch("bot.cogs.moderation.infraction._utils.get_active_infraction")
+ @patch("bot.cogs.moderation.infraction._utils.post_infraction")
async def test_apply_ban_reason_truncation(self, post_infraction_mock, get_active_mock):
"""Should truncate reason for `ctx.guild.ban`."""
get_active_mock.return_value = None
@@ -39,7 +39,7 @@ class TruncationTests(unittest.IsolatedAsyncioTestCase):
self.ctx, {"foo": "bar"}, self.target, self.ctx.guild.ban.return_value
)
- @patch("bot.cogs.moderation.infraction.utils.post_infraction")
+ @patch("bot.cogs.moderation.infraction._utils.post_infraction")
async def test_apply_kick_reason_truncation(self, post_infraction_mock):
"""Should truncate reason for `Member.kick`."""
post_infraction_mock.return_value = {"foo": "bar"}