Skip to content

Commit 7ed6840

Browse files
committed
- Add test for channel_info command;
- Add update channel_info file; - fix test_base
1 parent 264b311 commit 7ed6840

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/commands/test_channel_info.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ 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, usernames):
34+
def test_channel_ids_from_urls_and_usernames(mocker):
35+
urls = ["https://www.youtube.com/@Turicas/featured", "https://www.youtube.com/c/PythonicCaf%C3%A9"]
36+
usernames = ["Turicas", "PythonicCafe"]
37+
3538
ids_from_urls_mock = "id_from_url"
3639
ids_from_usernames_mock = "id_from_username"
3740
youtube_mock = mocker.patch("youtool.commands.channel_info.YouTube")
@@ -44,14 +47,12 @@ def test_channel_ids_from_urls_and_usernames(mocker, channels_urls, usernames):
4447
youtube_mock.return_value.channel_id_from_username = channel_id_from_username_mock
4548
youtube_mock.return_value.channels_infos = channels_infos_mock
4649

47-
ChannelInfo.execute(urls=channels_urls, usernames=usernames)
50+
ChannelInfo.execute(urls=urls, usernames=usernames)
4851

4952
channel_id_from_url_mock.assert_has_calls(
50-
[call(url) for url in channels_urls]
53+
[call(url) for url in urls]
5154
)
5255
channel_id_from_username_mock.assert_has_calls(
5356
[call(username) for username in usernames]
5457
)
55-
channels_infos_mock.assert_called_once()
56-
assert ids_from_usernames_mock in channels_infos_mock.call_args.args[0]
57-
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)