mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
mldonkey: Add backup/restore support
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
f6d3af15ec
commit
1c8c9d067a
@ -15,7 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
@apps @mldonkey @sso
|
||||
@apps @mldonkey @backups @sso
|
||||
Feature: MLDonkey eDonkey Network Client
|
||||
Run the eDonkey Network client.
|
||||
|
||||
@ -41,12 +41,12 @@ Scenario: Disable mldonkey application
|
||||
# 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
|
||||
# And I upload a sample ed2k file to mldonkey
|
||||
# And I create a backup of the mldonkey app data
|
||||
# And all ed2k files are removed from mldonkey
|
||||
# And I restore the mldonkey app data backup
|
||||
# Then the mldonkey service should be running
|
||||
# And there should be 1 torrents listed in mldonkey
|
||||
Scenario: Backup and restore mldonkey
|
||||
Given the mldonkey application is enabled
|
||||
When all ed2k files are removed from mldonkey
|
||||
And I upload a sample ed2k file to mldonkey
|
||||
And I create a backup of the mldonkey app data
|
||||
And all ed2k files are removed from 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
|
||||
|
||||
@ -120,6 +120,23 @@ def mediawiki_verify_text(browser):
|
||||
assert site.mediawiki_has_main_page(browser)
|
||||
|
||||
|
||||
@when('all ed2k files are removed from mldonkey')
|
||||
def mldonkey_remove_all_ed2k_files(browser):
|
||||
site.mldonkey_remove_all_ed2k_files(browser)
|
||||
|
||||
|
||||
@when('I upload a sample ed2k file to mldonkey')
|
||||
def mldonkey_upload_sample_ed2k_file(browser):
|
||||
site.mldonkey_upload_sample_ed2k_file(browser)
|
||||
|
||||
|
||||
@then(
|
||||
parsers.parse(
|
||||
'there should be {ed2k_files_number:d} ed2k files listed in mldonkey'))
|
||||
def mldonkey_assert_number_of_ed2k_files(browser, ed2k_files_number):
|
||||
assert ed2k_files_number == site.mldonkey_get_number_of_ed2k_files(browser)
|
||||
|
||||
|
||||
@given('repro has been configured')
|
||||
def repro_configure(browser):
|
||||
site.repro_configure(browser)
|
||||
|
||||
@ -230,6 +230,37 @@ def jsxc_has_contact(browser):
|
||||
return bool(contact)
|
||||
|
||||
|
||||
def _mldonkey_submit_command(browser, command):
|
||||
"""Submit a command to mldonkey."""
|
||||
with browser.get_iframe('commands') as commands_frame:
|
||||
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')
|
||||
_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')
|
||||
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')
|
||||
|
||||
with browser.get_iframe('commands') as commands_frame:
|
||||
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'))
|
||||
|
||||
|
||||
def transmission_remove_all_torrents(browser):
|
||||
"""Remove all torrents from transmission."""
|
||||
browser.visit(config['DEFAULT']['url'] + '/transmission')
|
||||
|
||||
@ -26,7 +26,7 @@ from plinth.menu import main_menu
|
||||
from plinth.modules.users import register_group
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
from .manifest import clients
|
||||
from .manifest import backup, clients
|
||||
|
||||
version = 1
|
||||
|
||||
|
||||
@ -33,7 +33,26 @@ clients = validate([{
|
||||
|
||||
backup = validate_backup({
|
||||
'config': {
|
||||
'files': ['/var/lib/mldonkey/*.ini']
|
||||
'files': [
|
||||
'/var/lib/mldonkey/bittorrent.ini',
|
||||
'/var/lib/mldonkey/bt_dht.ini',
|
||||
'/var/lib/mldonkey/directconnect.ini',
|
||||
'/var/lib/mldonkey/donkey.ini',
|
||||
'/var/lib/mldonkey/downloads.ini',
|
||||
'/var/lib/mldonkey/files.ini',
|
||||
'/var/lib/mldonkey/file_sources.ini',
|
||||
'/var/lib/mldonkey/fileTP.ini',
|
||||
'/var/lib/mldonkey/friends.ini',
|
||||
'/var/lib/mldonkey/searches.ini',
|
||||
'/var/lib/mldonkey/servers.ini',
|
||||
'/var/lib/mldonkey/shared_files.ini',
|
||||
'/var/lib/mldonkey/shared_files_new.ini',
|
||||
'/var/lib/mldonkey/statistics.ini',
|
||||
'/var/lib/mldonkey/stats_bt.ini',
|
||||
'/var/lib/mldonkey/stats.ini',
|
||||
'/var/lib/mldonkey/stats_mod.ini',
|
||||
'/var/lib/mldonkey/users.ini'
|
||||
]
|
||||
},
|
||||
'services': ['mldonkey-server']
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user