Skip to content

Commit 6a7542a

Browse files
committed
- Add test for channel_info command;
- Add update channel_info file; - fix test_base
1 parent ebfadcf commit 6a7542a

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

tests/commands/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_data_from_csv_column_not_found(mock_csv_file):
111111
file_path = Path("tests/resources/csv_column_not_found.csv")
112112
with pytest.raises(Exception) as exc_info:
113113
Command.data_from_csv(file_path, "NonExistentColumn")
114-
assert f"Column NonExistentColumn not found on {file_path}" in str(exc_info.value)
114+
assert "Column NonExistentColumn not found on tests/resources/csv_column_not_found.csv" in str(exc_info.value)
115115

116116

117117
@pytest.fixture

tests/commands/test_channel_info.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ def test_filter_fields():
3131
assert filtered_info == expected_result, f"Expected {expected_result}, but got {filtered_info}"
3232

3333

34-
def test_channel_ids_from_urls_and_usernames(mocker, channels_urls):
35-
"""Test to verify fetching channel IDs from both URLs and usernames.
36-
37-
This test checks if the `execute` method of the `ChannelInfo` class correctly fetches channel IDs
38-
from a list of URLs and usernames, and then calls the `channels_infos` method with these IDs.
39-
"""
34+
def test_channel_ids_from_urls_and_usernames(mocker):
4035
urls = ["https://www.youtube.com/@Turicas/featured", "https://www.youtube.com/c/PythonicCaf%C3%A9"]
4136
usernames = ["Turicas", "PythonicCafe"]
4237

@@ -52,14 +47,12 @@ def test_channel_ids_from_urls_and_usernames(mocker, channels_urls):
5247
youtube_mock.return_value.channel_id_from_username = channel_id_from_username_mock
5348
youtube_mock.return_value.channels_infos = channels_infos_mock
5449

55-
ChannelInfo.execute(urls=channels_urls, usernames=usernames)
50+
ChannelInfo.execute(urls=urls, usernames=usernames)
5651

5752
channel_id_from_url_mock.assert_has_calls(
58-
[call(url) for url in channels_urls]
53+
[call(url) for url in urls]
5954
)
6055
channel_id_from_username_mock.assert_has_calls(
6156
[call(username) for username in usernames]
6257
)
63-
channels_infos_mock.assert_called_once()
64-
assert ids_from_usernames_mock in channels_infos_mock.call_args.args[0]
65-
assert ids_from_urls_mock in channels_infos_mock.call_args.args[0]
58+
channels_infos_mock.assert_called_once_with([ids_from_urls_mock, ids_from_usernames_mock])

0 commit comments

Comments
 (0)