mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
bind: Add functional tests
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
6cfd5774f0
commit
a043063ee2
52
functional_tests/features/bind.feature
Normal file
52
functional_tests/features/bind.feature
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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 @bind @backups
|
||||
Feature: Bind Domain Name Server
|
||||
Configure the Bind Domain Name Server.
|
||||
|
||||
Background:
|
||||
Given I'm a logged in user
|
||||
Given the bind application is installed
|
||||
|
||||
Scenario: Enable bind application
|
||||
Given the bind application is disabled
|
||||
When I enable the bind application
|
||||
Then the bind service should be running
|
||||
|
||||
Scenario: Disable bind application
|
||||
Given the bind application is enabled
|
||||
When I disable the bind application
|
||||
Then the bind service should not be running
|
||||
|
||||
Scenario: Set bind forwarders
|
||||
Given the bind application is enabled
|
||||
And bind forwarders are set to 1.1.1.1
|
||||
When I set bind forwarders to 1.1.1.1 1.0.0.1
|
||||
Then bind forwarders should be 1.1.1.1 1.0.0.1
|
||||
|
||||
Scenario: Enable bind DNSSEC
|
||||
Given the bind application is enabled
|
||||
And bind DNSSEC is disabled
|
||||
When I enable bind DNSSEC
|
||||
Then bind DNSSEC should be enabled
|
||||
|
||||
Scenario: Disable bind DNSSEC
|
||||
Given the bind application is enabled
|
||||
And bind DNSSEC is disabled
|
||||
When I disable bind DNSSEC
|
||||
Then bind DNSSEC should be disabled
|
||||
@ -177,3 +177,35 @@ def pagekite_configure(browser, host, port, kite_name, kite_secret):
|
||||
def pagekite_assert_configured(browser, host, port, kite_name, kite_secret):
|
||||
assert (host, port, kite_name,
|
||||
kite_secret) == system.pagekite_get_configuration(browser)
|
||||
|
||||
|
||||
@given(parsers.parse('bind forwarders are set to {forwarders}'))
|
||||
def bind_given_set_forwarders(browser, forwarders):
|
||||
system.bind_set_forwarders(browser, forwarders)
|
||||
|
||||
|
||||
@when(parsers.parse('I set bind forwarders to {forwarders}'))
|
||||
def bind_set_forwarders(browser, forwarders):
|
||||
system.bind_set_forwarders(browser, forwarders)
|
||||
|
||||
|
||||
@then(parsers.parse('bind forwarders should be {forwarders}'))
|
||||
def bind_assert_forwarders(browser, forwarders):
|
||||
assert system.bind_get_forwarders(browser) == forwarders
|
||||
|
||||
|
||||
@given(parsers.parse('bind DNSSEC is {enable:w}'))
|
||||
def bind_given_enable_dnssec(browser, enable):
|
||||
should_enable = (enable == 'enabled')
|
||||
system.bind_enable_dnssec(browser, should_enable)
|
||||
|
||||
|
||||
@when(parsers.parse('I {enable:w} bind DNSSEC'))
|
||||
def bind_enable_dnssec(browser, enable):
|
||||
should_enable = (enable == 'enable')
|
||||
system.bind_enable_dnssec(browser, should_enable)
|
||||
|
||||
|
||||
@then(parsers.parse('bind DNSSEC should be {enabled:w}'))
|
||||
def bind_assert_dnssec(browser, enabled):
|
||||
assert system.bind_get_dnssec(browser) == (enabled == 'enabled')
|
||||
|
||||
@ -26,7 +26,7 @@ from support import config
|
||||
from .service import wait_for_page_update
|
||||
|
||||
sys_modules = [
|
||||
'avahi', 'backups', 'cockpit', 'config', 'datetime', 'diagnostics',
|
||||
'avahi', 'backups', 'bind', 'cockpit', 'config', 'datetime', 'diagnostics',
|
||||
'dynamicdns', 'firewall', 'letsencrypt', 'monkeysphere', 'names',
|
||||
'networks', 'pagekite', 'power', 'snapshot', 'upgrades', 'users'
|
||||
]
|
||||
|
||||
@ -228,3 +228,33 @@ def pagekite_get_configuration(browser):
|
||||
int(browser.find_by_name('pagekite-server_port').value),
|
||||
browser.find_by_name('pagekite-kite_name').value,
|
||||
browser.find_by_name('pagekite-kite_secret').value)
|
||||
|
||||
|
||||
def bind_set_forwarders(browser, forwarders):
|
||||
"""Set the forwarders list (space separated) in bind configuration."""
|
||||
nav_to_module(browser, 'bind')
|
||||
browser.fill('forwarders', forwarders)
|
||||
submit(browser, form_class='form-configuration')
|
||||
|
||||
|
||||
def bind_get_forwarders(browser):
|
||||
"""Return the forwarders list (space separated) in bind configuration."""
|
||||
nav_to_module(browser, 'bind')
|
||||
return browser.find_by_name('forwarders').first.value
|
||||
|
||||
|
||||
def bind_enable_dnssec(browser, enable):
|
||||
"""Enable/disable DNSSEC in bind configuration."""
|
||||
nav_to_module(browser, 'bind')
|
||||
if enable:
|
||||
browser.check('enable_dnssec')
|
||||
else:
|
||||
browser.uncheck('enable_dnssec')
|
||||
|
||||
submit(browser, form_class='form-configuration')
|
||||
|
||||
|
||||
def bind_get_dnssec(browser):
|
||||
"""Return whether DNSSEC is enabled/disabled in bind configuration."""
|
||||
nav_to_module(browser, 'bind')
|
||||
return browser.find_by_name('enable_dnssec').first.checked
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user