From e34a464835638b39acabd62f5a8efd8d64d655c0 Mon Sep 17 00:00:00 2001 From: Safihre Date: Fri, 8 Feb 2019 16:12:50 +0100 Subject: [PATCH] Py3: Add new tests to download-test - zip, passworded --- sabnzbd/assembler.py | 6 +----- tests/test_functional_config.py | 8 +------- tests/test_functional_downloads.py | 8 ++++++++ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sabnzbd/assembler.py b/sabnzbd/assembler.py index af485aa..d4e9923 100644 --- a/sabnzbd/assembler.py +++ b/sabnzbd/assembler.py @@ -164,9 +164,7 @@ class Assembler(Thread): break # Sleep to allow decoder/assembler switching - sleep(0.0001) article = decodetable[articlenum] - data = ArticleCache.do.load_article(article) if not data: @@ -180,8 +178,6 @@ class Assembler(Thread): fout.close() set_permissions(path) nzf.md5sum = md5.digest() - del md5 - return path @@ -262,7 +258,7 @@ def check_encrypted_and_unwanted_files(nzo, filepath): logging.info('Trying password "%s" on job "%s"', password, nzo.final_name) try: zf.setpassword(password) - except: + except rarfile.Error: # On weird passwords the setpassword() will fail # but the actual rartest() will work pass diff --git a/tests/test_functional_config.py b/tests/test_functional_config.py index 748baff..027634e 100644 --- a/tests/test_functional_config.py +++ b/tests/test_functional_config.py @@ -90,19 +90,13 @@ class SABnzbdConfigCategories(SABnzbdBaseTest): class SABnzbdConfigRSS(SABnzbdBaseTest): - rss_url = "https://nzbindex.nl/rss/?q=reftestnzb&sort=agedesc&max=25" + rss_url = "https://sabnzbd.org/tests/rss_feed_test.xml" rss_name = "_SeleniumFeed" def test_rss_basic_flow(self): # Test if base page works self.open_page("http://%s:%s/sabnzbd/config/rss" % (SAB_HOST, SAB_PORT)) - # Test if we can reach the url - test_request = requests.get(self.rss_url) - if not test_request.ok: - # Failures are now allowed - pytest.xfail("RSS URL unavailable: %s" % self.rss_url) - # Uncheck enabled-checkbox for new feeds self.driver.find_element_by_xpath('//form[@action="add_rss_feed"]//input[@name="enable"]').click() input_name = self.driver.find_element_by_xpath('//form[@action="add_rss_feed"]//input[@name="feed"]') diff --git a/tests/test_functional_downloads.py b/tests/test_functional_downloads.py index db0fa85..150b24c 100644 --- a/tests/test_functional_downloads.py +++ b/tests/test_functional_downloads.py @@ -126,6 +126,14 @@ class SABnzbdDownloadFlow(SABnzbdBaseTest): self.is_server_configured() self.add_nzb_from_url("http://sabnzbd.org/tests/test_win_unicode.nzb", "frènch_german_demö") + def test_download_passworded(self): + self.is_server_configured() + self.add_nzb_from_url("https://sabnzbd.org/tests/test_passworded%7B%7Bsecret%7D%7D.nzb", "random-1MB.bin") + + def test_download_zip(self): + self.is_server_configured() + self.add_nzb_from_url("https://sabnzbd.org/tests/test_zip.nzb", "testfile.bin") + @pytest.mark.skip(reason="Fails due to wrong par2-renaming. Needs fixing.") def test_download_win_unicode(self): self.is_server_configured()