22import pytest
33
44from io import StringIO
5- < << << << HEAD
65from unittest .mock import Mock
7- == == == =
8- from unittest .mock import Mock , call
9- > >> >> >> 0e02 e77 (- Add test for video_search command ;)
6+
107from datetime import datetime
118
129from youtool .commands .video_search import VideoSearch
1310
1411
1512def test_video_search_string_output (mocker , videos_ids , videos_urls ):
16- < << << << HEAD
1713 """Test the execution of the video-search command and verify the output as string.
1814
1915 This test simulates the execution of the `VideoSearch.execute` command with a list of video IDs and URLs,
2016 and checks if the output is correctly formatted as a CSV string.
2117 """
22- == == == =
23- >> >> >> > 0e02 e77 (- Add test for video_search command ;)
2418 youtube_mock = mocker .patch ("youtool.commands.video_search.YouTube" )
2519 expected_videos_infos = [
2620 {
@@ -43,14 +37,11 @@ def test_video_search_string_output(mocker, videos_ids, videos_urls):
4337
4438
4539def test_video_search_file_output (mocker , videos_ids , videos_urls , tmp_path ):
46- << << << < HEAD
4740 """Test the execution of the video-search command and verify the output to a file.
4841
4942 This test simulates the execution of the `VideoSearch.execute` command with a list of video IDs and URLs,
5043 and checks if the output is correctly written to a CSV file.
5144 """
52- == == == =
53- >> >> >> > 0e02 e77 (- Add test for video_search command ;)
5445 youtube_mock = mocker .patch ("youtool.commands.video_search.YouTube" )
5546 expected_videos_infos = [
5647 {
@@ -82,7 +73,6 @@ def test_video_search_file_output(mocker, videos_ids, videos_urls, tmp_path):
8273
8374
8475def test_video_search_no_id_and_url_error ():
85- << << << < HEAD
8676 """Test if the video-search command raises an exception when neither IDs nor URLs are provided.
8777
8878 This test checks if executing the `VideoSearch.execute` command without providing IDs or URLs
@@ -91,7 +81,6 @@ def test_video_search_no_id_and_url_error():
9181 Assertions:
9282 - Assert that the raised exception matches the expected error message.
9383 """
94- == == == =
95- >> >> >> > 0e02 e77 (- Add test for video_search command ;)
84+
9685 with pytest .raises (Exception , match = "Either 'ids' or 'urls' must be provided" ):
9786 VideoSearch .execute (ids = None , urls = None )
0 commit comments