From 22dd2d26f3a1a17d1370d36d5b68394967d1018b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 28 Jan 2019 10:51:23 -0800 Subject: [PATCH] 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 --- functional_tests/features/mldonkey.feature | 20 ++++++++++---------- functional_tests/support/site.py | 13 ++++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/functional_tests/features/mldonkey.feature b/functional_tests/features/mldonkey.feature index 8f77cc5f9..3169eb078 100644 --- a/functional_tests/features/mldonkey.feature +++ b/functional_tests/features/mldonkey.feature @@ -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 diff --git a/functional_tests/support/site.py b/functional_tests/support/site.py index f1603a263..b16725be8 100644 --- a/functional_tests/support/site.py +++ b/functional_tests/support/site.py @@ -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):