From ea4b71434374c156f4b52db170f4aadbeab8d90c Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 24 Apr 2024 14:39:17 +0200 Subject: [PATCH] Test videos command --- tests/test_cli.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 49640d4..eaaf886 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -107,3 +107,31 @@ def test_download_video(runner: CliRunner): "Output: 2024-03-14_2090131595_frozenflygone_frost_fatales_2024_day_1.mkv" in result.stdout ) assert "Dry run, video not downloaded." in result.stdout + + +def test_videos(runner: CliRunner): + result = runner.invoke(cli.videos, ["gamesdonequick", "--json"]) + assert_ok(result) + videos = json.loads(result.stdout) + + assert videos["count"] == 10 + assert videos["totalCount"] > 0 + video = videos["videos"][0] + + result = runner.invoke(cli.videos, "gamesdonequick") + assert_ok(result) + + assert f"Video {video['id']}" in result.stdout + assert video["title"] in result.stdout + + result = runner.invoke(cli.videos, ["gamesdonequick", "--compact"]) + assert_ok(result) + + assert video["id"] in result.stdout + assert video["title"] in result.stdout + + +def test_videos_channel_not_found(runner: CliRunner): + result = runner.invoke(cli.videos, ["doesnotexisthopefully"]) + assert result.exit_code == 1 + assert result.stderr.strip() == "Error: Channel doesnotexisthopefully not found"