Fix datetime in unittests
This commit is contained in:
@@ -14,7 +14,8 @@ def protected(func):
|
||||
async def wrapper(client, message):
|
||||
if int(message.from_user.id) not in allowed_ids:
|
||||
log.warning(
|
||||
f"User with ID {message.from_user.id} attempted to text this bot!")
|
||||
f"User with ID {message.from_user.id} attempted"
|
||||
"to text this bot!")
|
||||
log.info(
|
||||
f"Only users allowed are: {' '.join(allowed_ids)}")
|
||||
return await message.reply_text("You are not on the list!")
|
||||
|
||||
@@ -293,7 +293,7 @@ class TestDownloadTTVideo(unittest.TestCase):
|
||||
def test_download_tt_video_with_valid_video(self, mock_datetime, mock_snaptik):
|
||||
# Mock datetime
|
||||
mock_now = datetime(2023, 1, 1, 12, 0, 0)
|
||||
mock_datetime.datetime.now.return_value = mock_now
|
||||
mock_datetime.now.return_value = mock_now
|
||||
|
||||
# Read the content of valid.mp4
|
||||
with open(self.valid_video_path, 'rb') as f:
|
||||
@@ -322,7 +322,7 @@ class TestDownloadTTVideo(unittest.TestCase):
|
||||
def test_download_tt_video_with_invalid_video(self, mock_datetime, mock_snaptik):
|
||||
# Mock datetime
|
||||
mock_now = datetime(2023, 1, 1, 12, 0, 0)
|
||||
mock_datetime.datetime.now.return_value = mock_now
|
||||
mock_datetime.now.return_value = mock_now
|
||||
|
||||
# Read the content of invalid.mp4
|
||||
with open(self.invalid_video_path, 'rb') as f:
|
||||
|
||||
Reference in New Issue
Block a user