From 16936aad19978078a872ce8ebec82f30a3e7442f Mon Sep 17 00:00:00 2001 From: Harbys Date: Fri, 27 Nov 2020 08:44:20 +0100 Subject: move to Scheduler --- tests/bot/exts/moderation/test_stream.py | 56 -------------------------------- 1 file changed, 56 deletions(-) (limited to 'tests') diff --git a/tests/bot/exts/moderation/test_stream.py b/tests/bot/exts/moderation/test_stream.py index 467c373aa..15956a9de 100644 --- a/tests/bot/exts/moderation/test_stream.py +++ b/tests/bot/exts/moderation/test_stream.py @@ -1,28 +1,10 @@ -import asyncio import unittest -from async_rediscache import RedisSession from bot.constants import Roles from bot.exts.moderation.stream import Stream from tests.helpers import MockBot, MockMember, MockRole -redis_session = None -redis_loop = asyncio.get_event_loop() - - -def setUpModule(): # noqa: N802 - """Create and connect to the fakeredis session.""" - global redis_session - redis_session = RedisSession(use_fakeredis=True) - redis_loop.run_until_complete(redis_session.connect()) - - -def tearDownModule(): # noqa: N802 - """Close the fakeredis session.""" - if redis_session: - redis_loop.run_until_complete(redis_session.close()) - class StreamCommandTest(unittest.IsolatedAsyncioTestCase): @@ -30,44 +12,6 @@ class StreamCommandTest(unittest.IsolatedAsyncioTestCase): self.bot = MockBot() self.cog = Stream(self.bot) - def test_linking_time_format_from_alias_or_key(self): - """ - User provided time format needs to be lined to a proper entry in TIME_FORMATS - This Test checks _link_from_alias method - Checking for whether alias or key exists in TIME_FORMATS is done before calling this function - """ - - test_cases = (("sec", "second"), - ("s", "second"), - ("seconds", "second"), - ("second", "second"), - ("secs", "second"), - ("min", "minute"), - ("m", "minute"), - ("minutes", "minute"), - ("hr", "hour"), - ("hrs", "hour"), - ("hours", "hour"), - ("d", "day"), - ("days", "day"), - ("yr", "year"), - ("yrs", "year"), - ("y", "year")) - - for case in test_cases: - linked = self.cog._link_from_alias(case[0])[1] - self.assertEqual(linked, case[1]) - - def test_parsing_duration_and_time_format_to_seconds(self): - """ - Test calculating time in seconds from duration and time unit - This test is technically dependent on _link_from_alias function, not the best practice but necessary - """ - test_cases = ((1, "minute", 60), (5, "second", 5), (2, "day", 172800)) - for case in test_cases: - time_in_seconds = self.cog._parse_time_to_seconds(case[0], case[1]) - self.assertEqual(time_in_seconds, case[2]) - def test_checking_if_user_has_streaming_permission(self): """ Test searching for video role in Member.roles -- cgit v1.2.3