mldonkey: Add functional test for uploading

- Run yapf for automatic formatting.

- Move disable test to the end so that after all test are run, app is usually
  disabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2019-01-28 10:51:23 -08:00
parent 1c8c9d067a
commit 22dd2d26f3
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 18 additions and 15 deletions

View File

@ -29,18 +29,12 @@ Scenario: Enable mldonkey application
Then the mldonkey service should be running
Then the mldonkey site should be available
Scenario: Disable mldonkey application
Scenario: Upload an ed2k file to mldonkey
Given the mldonkey application is enabled
When I disable the mldonkey application
Then the mldonkey service should not be running
Then the mldonkey site should not be available
When all ed2k files are removed from mldonkey
And I upload a sample ed2k file to mldonkey
Then there should be 1 ed2k files listed in mldonkey
# Scenario: Upload an ed2k file to mldonkey
# Given the mldonkey application is enabled
# When all ed2k files are removed from mldonkey
# And I upload a sample ed2k file to mldonkey
# Then there should be 1 ed2k file listed in mldonkey
#
Scenario: Backup and restore mldonkey
Given the mldonkey application is enabled
When all ed2k files are removed from mldonkey
@ -50,3 +44,9 @@ Scenario: Backup and restore mldonkey
And I restore the mldonkey app data backup
Then the mldonkey service should be running
And there should be 1 ed2k files listed in mldonkey
Scenario: Disable mldonkey application
Given the mldonkey application is enabled
When I disable the mldonkey application
Then the mldonkey service should not be running
Then the mldonkey site should not be available

View File

@ -236,29 +236,32 @@ def _mldonkey_submit_command(browser, command):
commands_frame.find_by_css('.txt2').fill(command)
commands_frame.find_by_css('.but2').click()
def mldonkey_remove_all_ed2k_files(browser):
"""Remove all ed2k files from mldonkey."""
browser.visit(config['DEFAULT']['url'] + '/mldonkey')
browser.visit(config['DEFAULT']['url'] + '/mldonkey/')
_mldonkey_submit_command(browser, 'cancel all')
_mldonkey_submit_command(browser, 'confirm yes')
def mldonkey_upload_sample_ed2k_file(browser):
"""Upload a sample ed2k file into mldonkey."""
browser.visit(config['DEFAULT']['url'] + '/mldonkey')
browser.visit(config['DEFAULT']['url'] + '/mldonkey/')
dllink_command = 'dllink ed2k://|file|foo.bar|123|0123456789ABCDEF0123456789ABCDEF|/'
_mldonkey_submit_command(browser, dllink_command)
def mldonkey_get_number_of_ed2k_files(browser):
"""Return the number of ed2k files currently in mldonkey."""
browser.visit(config['DEFAULT']['url'] + '/mldonkey')
browser.visit(config['DEFAULT']['url'] + '/mldonkey/')
with browser.get_iframe('commands') as commands_frame:
commands_frame.find_by_xpath('//tr//td[contains(text(), "Transfers")]').click()
commands_frame.find_by_xpath(
'//tr//td[contains(text(), "Transfers")]').click()
with browser.get_iframe('output') as output_frame:
return len(output_frame.find_by_css('.dl-1')) + len(output_frame.find_by_css('.dl-2'))
return len(output_frame.find_by_css('.dl-1')) + len(
output_frame.find_by_css('.dl-2'))
def transmission_remove_all_torrents(browser):