From a27d7cddb34d5ddeded523eefd22ead5e880ea82 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Tue, 20 Dec 2016 20:13:22 +1030 Subject: [PATCH] fix tests and add another --- tests/end2end/features/downloads.feature | 13 ++++++++++--- tests/end2end/features/test_downloads_bdd.py | 13 ++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index 3bdba2c41..d141f8af5 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -338,19 +338,26 @@ Feature: Downloading things from a website. Then "Opening *download.bin* with [*python*]" should be logged Scenario: Opening a download with default-open-dispatcher set - When I set general -> default-open-dispatcher to python {} -c "import sys; print(sys.argv[1])" + When I set a test python default-open-dispatcher And I open data/downloads/download.bin without waiting And I wait until the download is finished - And I open the download with no args + And I run :download-open Then "Opening *download.bin* with [*python*]" should be logged Scenario: Opening a download with default-open-dispatcher set to cat When I set general -> default-open-dispatcher to cat And I open data/downloads/download.bin without waiting And I wait until the download is finished - And I open the download with no args + And I run :download-open Then "Opening *download.bin* with [*cat*]" should be logged + Scenario: Opening a download with default-open-dispatcher set and override + When I set general -> default-open-dispatcher to cat + And I open data/downloads/download.bin without waiting + And I wait until the download is finished + And I open the download + Then "Opening *download.bin* with [*python*]" should be logged + Scenario: Opening a download which does not exist When I run :download-open with count 42 Then the error "There's no download 42!" should be shown diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py index 2538a033e..753cfa75c 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -44,6 +44,7 @@ def temporary_download_dir(quteproc, tmpdir): unwritable.ensure(dir=True) unwritable.chmod(0) + @bdd.given("I clean old downloads") def clean_old_downloads(quteproc): quteproc.send_cmd(':download-cancel --all') @@ -100,6 +101,13 @@ def download_prompt(tmpdir, quteproc, path): quteproc.send_cmd(':leave-mode') +@bdd.when("I set a test python default-open-dispatcher") +def default_open_dispatcher_python(quteproc, tmpdir): + cmd = '{} -c "import sys; print(sys.argv[1])"'.format( + shlex.quote(sys.executable)) + quteproc.set_setting('general', 'default-open-dispatcher', cmd) + + @bdd.when("I open the download") def download_open(quteproc): cmd = '{} -c "import sys; print(sys.argv[1])"'.format( @@ -107,11 +115,6 @@ def download_open(quteproc): quteproc.send_cmd(':download-open {}'.format(cmd)) -@bdd.when("I open the download with no args") -def download_open_plain(quteproc): - quteproc.send_cmd(':download-open') - - @bdd.when("I open the download with a placeholder") def download_open_placeholder(quteproc): cmd = '{} -c "import sys; print(sys.argv[1])"'.format(