From 9cc7c05d8a349f1d8d7316e67dcada472fbb6a03 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Sat, 27 Aug 2022 11:58:19 +0200 Subject: [PATCH] Expand tests --- tests/test_api.py | 22 +++++++++++++--------- tests/test_twitch.py | 5 +++++ 2 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 tests/test_twitch.py diff --git a/tests/test_api.py b/tests/test_api.py index 5220666..e4ba17c 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -36,15 +36,19 @@ def test_get_videos(): def test_get_clips(): - """ - This test depends on the channel having some videos published. - """ - clips = twitch.get_channel_clips(TEST_CHANNEL, "all_time", 3) - assert clips["pageInfo"] - assert len(clips["edges"]) > 0 + page = twitch.get_channel_clips(TEST_CHANNEL, "all_time", 3) + assert len(page.clips) > 0 - slug = clips["edges"][0]["node"]["slug"] + slug = page.clips[0].slug clip = twitch.get_clip(slug) - assert clip["slug"] == slug + assert clip.slug == slug - assert get_clip_authenticated_url(slug, "source") + assert get_clip_authenticated_url(slug, "source").startswith("https") + + +def test_get_game(): + game_id = twitch.get_game_id("The Witness") + assert game_id == "17324" + + game_id = twitch.get_game_id("Does Not Exist Hoepfully") + assert game_id is None diff --git a/tests/test_twitch.py b/tests/test_twitch.py new file mode 100644 index 0000000..bc5bbc7 --- /dev/null +++ b/tests/test_twitch.py @@ -0,0 +1,5 @@ +from twitchdl.twitch import channel_clips_generator + + +# def test_clips_generator(): +# channel_clips_generator("foo", "bar", 100)