From baa9d3634fdd83a875b31a3c554b508f708d3737 Mon Sep 17 00:00:00 2001 From: Safihre Date: Fri, 8 Feb 2019 10:17:14 +0100 Subject: [PATCH] Py3: Reshuffle functional download-tests To be able to add more later --- tests/test_functional_downloads.py | 39 +++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tests/test_functional_downloads.py b/tests/test_functional_downloads.py index 4c7e71c..db0fa85 100644 --- a/tests/test_functional_downloads.py +++ b/tests/test_functional_downloads.py @@ -27,21 +27,13 @@ from tests.testhelper import * @pytest.mark.skipif("SAB_NEWSSERVER_HOST" not in os.environ, reason="Test-server not specified") class SABnzbdDownloadFlow(SABnzbdBaseTest): - def test_downloading_ordered(self): - # Wrapper for all the tests in order - self.start_wizard() - - # Basic test - self.add_nzb_from_url("http://sabnzbd.org/tests/basic_rar5.nzb", "testfile.bin") - - # Unicode test - self.add_nzb_from_url("http://sabnzbd.org/tests/unicode_rar.nzb", "\u4f60\u597d\u4e16\u754c.bin") - - # Test with unicode files generated on Windows - self.add_nzb_from_url("http://sabnzbd.org/tests/test_win_unicode.nzb", "frènch_german_demö") - - # Unicode test with a missing article - # self.add_nzb_from_url("http://sabnzbd.org/tests/unicode_rar_broken.nzb", u"\u4f60\u597d\u4e16\u754c.bin") + def is_server_configured(self): + """ Check if the wizard was already performed. + If not: run the wizard! + """ + with open(os.path.join(SAB_CACHE_DIR, 'sabnzbd.ini'), 'r') as config_file: + if self.newsserver_host not in config_file.read(): + self.start_wizard() def start_wizard(self): # Language-selection @@ -121,3 +113,20 @@ class SABnzbdDownloadFlow(SABnzbdBaseTest): # Shutil can't handle unicode, need to remove the file here os.remove(file_to_find) + + def test_download_basic_rar5(self): + self.is_server_configured() + self.add_nzb_from_url("http://sabnzbd.org/tests/basic_rar5.nzb", "testfile.bin") + + def test_download_unicode_rar(self): + self.is_server_configured() + self.add_nzb_from_url("http://sabnzbd.org/tests/unicode_rar.nzb", "\u4f60\u597d\u4e16\u754c.bin") + + def test_download_win_unicode(self): + self.is_server_configured() + self.add_nzb_from_url("http://sabnzbd.org/tests/test_win_unicode.nzb", "frènch_german_demö") + + @pytest.mark.skip(reason="Fails due to wrong par2-renaming. Needs fixing.") + def test_download_win_unicode(self): + self.is_server_configured() + self.add_nzb_from_url("http://sabnzbd.org/tests/unicode_rar_broken.nzb", u"\u4f60\u597d\u4e16\u754c.bin")