From 18fd2b4aef5a05e540257d1fc1d34f1bce7588f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 10:01:25 +0000 Subject: [PATCH] Address code review and CodeQL feedback: fix assertion logic and URL checks Agent-Logs-Url: https://github.com/thaitien280401-stack/RedditVideoMakerBot/sessions/51e17be8-4f67-4153-a83b-fffef32969b3 Co-authored-by: thaitien280401-stack <271128961+thaitien280401-stack@users.noreply.github.com> --- tests/test_upload_integration.py | 4 ++-- tests/test_videos.py | 4 ++-- tests/test_voice.py | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/test_upload_integration.py b/tests/test_upload_integration.py index 24340ea..3374861 100644 --- a/tests/test_upload_integration.py +++ b/tests/test_upload_integration.py @@ -196,7 +196,7 @@ class TestTikTokUploadIntegration: url = uploader.upload(m) assert url is not None - assert "tiktok.com" in url + assert url.startswith("https://www.tiktok.com/") # =================================================================== @@ -254,4 +254,4 @@ class TestFacebookUploadIntegration: url = uploader.upload(m) assert url is not None - assert "facebook.com" in url + assert url.startswith("https://www.facebook.com/") diff --git a/tests/test_videos.py b/tests/test_videos.py index 7136185..c580a40 100644 --- a/tests/test_videos.py +++ b/tests/test_videos.py @@ -67,5 +67,5 @@ class TestSaveData: with patch("builtins.open", m): save_data("test_channel", "output2.mp4", "Another Title", "thread_123", "gta") - # Should not write anything since ID exists - assert not m().write.called or m().seek.called is False + # Verify no new data was written (duplicate ID skipped) + assert not m().write.called diff --git a/tests/test_voice.py b/tests/test_voice.py index 77eafa6..46dafcb 100644 --- a/tests/test_voice.py +++ b/tests/test_voice.py @@ -43,12 +43,9 @@ class TestSanitizeText: text = "1+1 equals 2" result = sanitize_text(text) - # The + is replaced by "plus" via str.replace before regex strips it - # However, the regex removes standalone + first. - # The replacement text.replace("+", "plus") runs after regex. - # So "1+1" → regex removes "+" → "1 1" → replace doesn't find "+" → "1 1" - # But text.replace runs on the result, so let's check actual behavior. + # Verify numeric content is preserved after sanitization assert "1" in result + assert "equals" in result def test_removes_extra_whitespace(self): from utils.voice import sanitize_text