From 3d8dedc48bee1bf54c5ba11c82ca97e51a61ec3f Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Tue, 20 Dec 2016 12:09:30 +1030 Subject: [PATCH] add tests for default-open-dispatcher --- tests/end2end/features/downloads.feature | 14 ++++++++++++++ tests/end2end/features/test_downloads_bdd.py | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index b6a38da29..3bdba2c41 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -337,6 +337,20 @@ Feature: Downloading things from a website. And I open the download with a placeholder 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])" + 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 + 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 + Then "Opening *download.bin* with [*cat*]" 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 65ccf1f3e..2538a033e 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -44,7 +44,6 @@ 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') @@ -108,6 +107,11 @@ 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(