mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
dynamicdns: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
ffde6f1c18
commit
db32e885d9
@ -1,28 +0,0 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
# TODO Scenario: Configure GnuDIP service
|
|
||||||
# TODO Scenario: Configure noip.com service
|
|
||||||
# TODO Scenario: Configure selfhost.bz service
|
|
||||||
# TODO Scenario: Configure freedns.afraid.org service
|
|
||||||
# TODO Scenario: Configure other update URL service
|
|
||||||
|
|
||||||
@apps @dynamicdns
|
|
||||||
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: Capitalized domain name
|
|
||||||
Given dynamicdns is configured
|
|
||||||
When I change the domain name to FreedomBox.example.com
|
|
||||||
Then the domain name should be freedombox.example.com
|
|
||||||
|
|
||||||
@backups
|
|
||||||
Scenario: Backup and restore configuration
|
|
||||||
Given dynamicdns is configured
|
|
||||||
When I create a backup of the dynamicdns app data with name test_dynamicdns
|
|
||||||
And I change the dynamicdns configuration
|
|
||||||
And I restore the dynamicdns app data backup with name test_dynamicdns
|
|
||||||
Then dynamicdns should have the original configuration
|
|
||||||
@ -5,36 +5,43 @@ Functional, browser based tests for dynamicdns app.
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pytest_bdd import given, parsers, scenarios, then, when
|
import pytest
|
||||||
|
|
||||||
from plinth.tests import functional
|
from plinth.tests import functional
|
||||||
|
|
||||||
scenarios('dynamicdns.feature')
|
pytestmark = [
|
||||||
|
pytest.mark.system, pytest.mark.essential, pytest.mark.dynamicdns
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@given('dynamicdns is configured')
|
@pytest.fixture(scope='module', autouse=True)
|
||||||
def dynamicdns_configure(session_browser):
|
def fixture_background(session_browser):
|
||||||
|
"""Login."""
|
||||||
|
functional.login(session_browser)
|
||||||
|
|
||||||
|
|
||||||
|
def test_capitalized_domain_name(session_browser):
|
||||||
|
"""Test handling of capitalized domain name."""
|
||||||
_configure(session_browser)
|
_configure(session_browser)
|
||||||
|
_configure_domain(session_browser, 'FreedomBox.example.com')
|
||||||
|
assert _get_domain(session_browser) == 'freedombox.example.com'
|
||||||
|
|
||||||
|
|
||||||
@when('I change the dynamicdns configuration')
|
def test_backup_and_restore(session_browser):
|
||||||
def dynamicdns_change_config(session_browser):
|
"""Test backup and restore of configuration."""
|
||||||
|
_configure(session_browser)
|
||||||
|
functional.backup_create(session_browser, 'dynamicdns', 'test_dynamicdns')
|
||||||
|
|
||||||
_change_config(session_browser)
|
_change_config(session_browser)
|
||||||
|
functional.backup_restore(session_browser, 'dynamicdns', 'test_dynamicdns')
|
||||||
|
|
||||||
|
|
||||||
@when(parsers.parse('I change the domain name to {domain:S}'))
|
|
||||||
def dynamicdns_change_domain(session_browser, domain):
|
|
||||||
_configure_domain(session_browser, domain)
|
|
||||||
|
|
||||||
|
|
||||||
@then('dynamicdns should have the original configuration')
|
|
||||||
def dynamicdns_has_original_config(session_browser):
|
|
||||||
assert _has_original_config(session_browser)
|
assert _has_original_config(session_browser)
|
||||||
|
|
||||||
|
|
||||||
@then(parsers.parse('the domain name should be {domain:S}'))
|
# TODO Scenario: Configure GnuDIP service
|
||||||
def dynamicdns_has_domain(session_browser, domain):
|
# TODO Scenario: Configure noip.com service
|
||||||
assert _get_domain(session_browser) == domain
|
# TODO Scenario: Configure selfhost.bz service
|
||||||
|
# TODO Scenario: Configure freedns.afraid.org service
|
||||||
|
# TODO Scenario: Configure other update URL service
|
||||||
|
|
||||||
|
|
||||||
def _configure(browser):
|
def _configure(browser):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user