add tests for default-open-dispatcher

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

View File

@ -337,6 +337,20 @@ Feature: Downloading things from a website.
And I open the download with a placeholder And I open the download with a placeholder
Then "Opening *download.bin* with [*python*]" should be logged 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 Scenario: Opening a download which does not exist
When I run :download-open with count 42 When I run :download-open with count 42
Then the error "There's no download 42!" should be shown Then the error "There's no download 42!" should be shown

View File

@ -44,7 +44,6 @@ def temporary_download_dir(quteproc, tmpdir):
unwritable.ensure(dir=True) unwritable.ensure(dir=True)
unwritable.chmod(0) unwritable.chmod(0)
@bdd.given("I clean old downloads") @bdd.given("I clean old downloads")
def clean_old_downloads(quteproc): def clean_old_downloads(quteproc):
quteproc.send_cmd(':download-cancel --all') quteproc.send_cmd(':download-cancel --all')
@ -108,6 +107,11 @@ def download_open(quteproc):
quteproc.send_cmd(':download-open {}'.format(cmd)) 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") @bdd.when("I open the download with a placeholder")
def download_open_placeholder(quteproc): def download_open_placeholder(quteproc):
cmd = '{} -c "import sys; print(sys.argv[1])"'.format( cmd = '{} -c "import sys; print(sys.argv[1])"'.format(