Browse Source

Py3: Add new tests to download-test - zip, passworded

pull/1253/head
Safihre 6 years ago
parent
commit
e34a464835
  1. 6
      sabnzbd/assembler.py
  2. 8
      tests/test_functional_config.py
  3. 8
      tests/test_functional_downloads.py

6
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

8
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"]')

8
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()

Loading…
Cancel
Save