From 143a4af91b3aa9df0f8e7ca8f7fd1bcc135b414e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 9 Sep 2016 18:42:55 +0200 Subject: [PATCH] Improve :download-open tests --- tests/end2end/features/downloads.feature | 6 ++++++ tests/end2end/features/test_downloads_bdd.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index f2f1d944a..fbda16e54 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -222,6 +222,12 @@ Feature: Downloading things from a website. And I open the download Then "Opening *download.bin* with [*python*]" should be logged + Scenario: Opening a download with a placeholder + When I open data/downloads/download.bin + And I wait until the download is finished + And I open the download with a placeholder + 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 745a515f4..c7aab9b56 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -94,10 +94,16 @@ def download_prompt(tmpdir, quteproc, path): @bdd.when("I open the download") def download_open(quteproc): - cmd = '{} -c pass'.format(shlex.quote(sys.executable)) + cmd = '{} -c "import sys; print(sys.argv[1])"'.format(shlex.quote(sys.executable)) quteproc.send_cmd(':download-open {}'.format(cmd)) +@bdd.when("I open the download with a placeholder") +def download_open(quteproc): + cmd = '{} -c "import sys; print(sys.argv[1])"'.format(shlex.quote(sys.executable)) + quteproc.send_cmd(':download-open {} {{}}'.format(cmd)) + + @bdd.when("I directly open the download") def download_open_with_prompt(quteproc): cmd = '{} -c pass'.format(shlex.quote(sys.executable))