Fix datetime in unittests
All checks were successful
Build Docker image / test (push) Successful in 2m29s
Build Docker image / build (push) Successful in 49s

This commit is contained in:
Roman Krček
2024-10-13 19:13:12 +02:00
parent c1bf9c1e53
commit c68d3d8722
2 changed files with 4 additions and 3 deletions

View File

@@ -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!")

View File

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