Commit a1d1555d authored by James Valleroy's avatar James Valleroy

functional_tests: Test dynamicdns backup and restore

Signed-off-by: James Valleroy's avatarJames Valleroy <jvalleroy@mailbox.org>
parent cc384c59
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
@apps @dynamicdns @backups
Feature: Dynamic DNS Client
Update public IP to a GnuDIP server.
Background:
Given I'm a logged in user
And the dynamicdns application is installed
Scenario: Backup and restore configuration
Given dynamicdns is configured
When I create a backup of the dynamicdns app data
And I change the dynamicdns configuration
And I export the dynamicdns app data backup
And I restore the dynamicdns app data backup
Then dynamicdns should have the original configuration
......@@ -100,3 +100,33 @@ def verify_snapshot_count(browser, count):
@then(parsers.parse('the default app should be {app_name:w}'))
def default_app_should_be(browser, app_name):
assert system.check_home_page_redirect(browser, app_name)
@given('dynamicdns is configured')
def dynamicdns_configure(browser):
system.dynamicdns_configure(browser)
@when('I change the dynamicdns configuration')
def dynamicdns_change_config(browser):
system.dynamicdns_change_config(browser)
@then('dynamicdns should have the original configuration')
def dynamicdns_has_original_config(browser):
assert system.dynamicdns_has_original_config(browser)
@when(parsers.parse('I create a backup of the {app_name:w} app data'))
def backup_create(browser, app_name):
system.backup_create(browser, app_name)
@when(parsers.parse('I export the {app_name:w} app data backup'))
def backup_export(browser, app_name):
system.backup_export(browser, app_name)
@when(parsers.parse('I restore the {app_name:w} app data backup'))
def backup_restore(browser, app_name):
system.backup_restore(browser, app_name)
......@@ -20,9 +20,9 @@ from support import config
from .service import wait_for_page_update
sys_modules = [
'avahi', 'cockpit', 'config', 'datetime', 'diagnostics', 'firewall',
'letsencrypt', 'monkeysphere', 'names', 'networks', 'power', 'snapshot',
'upgrades', 'users'
'avahi', 'backups', 'cockpit', 'config', 'datetime', 'diagnostics',
'dynamicdns', 'firewall', 'letsencrypt', 'monkeysphere', 'names',
'networks', 'power', 'snapshot', 'upgrades', 'users'
]
default_url = config['DEFAULT']['url']
......
......@@ -99,3 +99,81 @@ def check_home_page_redirect(browser, app_name):
browser.visit(config['DEFAULT']['url'])
return browser.find_by_xpath(
"//a[contains(@href, '/plinth/') and @title='FreedomBox']")
def dynamicdns_configure(browser):
nav_to_module(browser, 'dynamicdns')
browser.find_link_by_href(
'/plinth/sys/dynamicdns/configure/').first.click()
browser.find_by_id('id_enabled').check()
browser.find_by_id('id_service_type').select('GnuDIP')
browser.find_by_id('id_dynamicdns_server').fill('example.com')
browser.find_by_id('id_dynamicdns_domain').fill('freedombox.example.com')
browser.find_by_id('id_dynamicdns_user').fill('tester')
browser.find_by_id('id_dynamicdns_secret').fill('testingtesting')
browser.find_by_id('id_dynamicdns_ipurl').fill(
'http://myip.datasystems24.de')
submit(browser)
def dynamicdns_has_original_config(browser):
nav_to_module(browser, 'dynamicdns')
browser.find_link_by_href(
'/plinth/sys/dynamicdns/configure/').first.click()
enabled = browser.find_by_id('id_enabled').value
service_type = browser.find_by_id('id_service_type').value
server = browser.find_by_id('id_dynamicdns_server').value
domain = browser.find_by_id('id_dynamicdns_domain').value
user = browser.find_by_id('id_dynamicdns_user').value
ipurl = browser.find_by_id('id_dynamicdns_ipurl').value
if enabled and service_type == 'GnuDIP' and server == 'example.com' \
and domain == 'freedombox.example.com' and user == 'tester' \
and ipurl == 'http://myip.datasystems24.de':
return True
else:
return False
def dynamicdns_change_config(browser):
nav_to_module(browser, 'dynamicdns')
browser.find_link_by_href(
'/plinth/sys/dynamicdns/configure/').first.click()
browser.find_by_id('id_enabled').check()
browser.find_by_id('id_service_type').select('GnuDIP')
browser.find_by_id('id_dynamicdns_server').fill('2.example.com')
browser.find_by_id('id_dynamicdns_domain').fill('freedombox2.example.com')
browser.find_by_id('id_dynamicdns_user').fill('tester2')
browser.find_by_id('id_dynamicdns_secret').fill('testingtesting2')
browser.find_by_id('id_dynamicdns_ipurl').fill(
'http://myip2.datasystems24.de')
submit(browser)
def backup_create(browser, app_name):
nav_to_module(browser, 'backups')
delete = browser.find_link_by_href(
'/plinth/sys/backups/delete/_functional_test_' + app_name + '/')
if delete:
delete.first.click()
submit(browser)
browser.find_link_by_href('/plinth/sys/backups/create/').first.click()
browser.find_by_id('id_backups-name').fill('_functional_test_' + app_name)
submit(browser)
def backup_export(browser, app_name):
nav_to_module(browser, 'backups')
browser.find_link_by_href(
'/plinth/sys/backups/export/_functional_test_'
+ app_name + '/').first.click()
browser.find_by_id('id_backups-disk_0').first.check()
submit(browser)
def backup_restore(browser, app_name):
nav_to_module(browser, 'backups')
browser.find_link_by_href(
'/plinth/sys/backups/restore/Root%2520Filesystem/_functional_test_'
+ app_name + '.tar.gz/').first.click()
submit(browser)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment