fix tests and add another

This commit is contained in:
Samuel Walladge 2016-12-20 20:13:22 +10:30
parent 3d8dedc48b
commit a27d7cddb3
No known key found for this signature in database
GPG Key ID: 44E2319D42B72AA6
2 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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(