From 7182326a52244b294ce8c4d81e14eed50d251086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Mon, 5 Dec 2022 13:25:51 +0100 Subject: [PATCH] Remove old tests --- tests/test_discord_rss_bot.py | 67 ----------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 tests/test_discord_rss_bot.py diff --git a/tests/test_discord_rss_bot.py b/tests/test_discord_rss_bot.py deleted file mode 100644 index 4b71937..0000000 --- a/tests/test_discord_rss_bot.py +++ /dev/null @@ -1,67 +0,0 @@ -import os - -from discord_rss_bot.discord_rss_bot import app, app_dir -from typer.testing import CliRunner - -runner = CliRunner() - - -def test_stats(): - result = runner.invoke(app, "stats") - assert result.exit_code == 0 - assert "Average number of entries per day:" in result.stdout - - -# def test_check(): -# result = runner.invoke(app, "check") -# Todo: Fix this test - - -def test_backup(): - # Where we store backups - backup_dir = os.path.join(app_dir, "backup") - - # Make sure the backup directory exists - os.makedirs(backup_dir, exist_ok=True) - - # Check how many files in the backup directory - files_before = len(os.listdir(backup_dir)) - - # Run the backup command - result = runner.invoke(app, "backup") - - # Check how many files in the backup directory after the backup - files_after = len(os.listdir(backup_dir)) - - # Check if the exit code is 0 and if we got one file more - assert result.exit_code == 0 - assert files_after == files_before + 1 - - -def test_add(): - result = runner.invoke(app, "add https://www.reddit.com/r/Games/new/.rss --no-notify-discord") - - # Check if the exit code is 0 and if the output contains the word "added" or "already" - assert result.exit_code == 0 - assert "added" or "already" in result.stdout - - -def test_delete(): - # https://typer.tiangolo.com/tutorial/testing/#testing-input - result = runner.invoke(app, "delete", input="1\nY\n") - - # Check if the exit code is 0 and if the output contains the word "deleted" - assert result.exit_code == 0 - assert "deleted" in result.stdout - - -def test_add_webhook(): - result = runner.invoke(app, "webhook-add https://discordapp.com/api/webhooks/123456789") - assert result.exit_code == 0 - assert "Webhook set to " in result.stdout - - -def test_get_webhook(): - result = runner.invoke(app, "webhook-get") - assert result.exit_code == 0 - assert "Webhook: " in result.stdout