diff --git a/plinth/modules/config/tests/test_functional.py b/plinth/modules/config/tests/test_functional.py index e063fde61..0b3ee1a37 100644 --- a/plinth/modules/config/tests/test_functional.py +++ b/plinth/modules/config/tests/test_functional.py @@ -20,7 +20,7 @@ def fixture_background(session_browser): def test_change_hostname(session_browser): """Test changing the hostname.""" - _set_hostname(session_browser, 'mybox') + functional.set_hostname(session_browser, 'mybox') assert _get_hostname(session_browser) == 'mybox' @@ -49,13 +49,6 @@ def _get_hostname(browser): return browser.find_by_id('id_hostname').value -def _set_hostname(browser, hostname): - functional.nav_to_module(browser, 'config') - browser.find_by_id('id_hostname').fill(hostname) - update_setup = browser.find_by_css('.btn-primary') - functional.submit(browser, element=update_setup) - - def _get_domain_name(browser): functional.nav_to_module(browser, 'config') return browser.find_by_id('id_domainname').value diff --git a/plinth/modules/ejabberd/tests/test_functional.py b/plinth/modules/ejabberd/tests/test_functional.py index 539d670da..1d816435c 100644 --- a/plinth/modules/ejabberd/tests/test_functional.py +++ b/plinth/modules/ejabberd/tests/test_functional.py @@ -29,6 +29,8 @@ class TestEjabberdApp(functional.BaseAppTests): def test_add_remove_domain(self, session_browser): """Test adding and removing a domain.""" functional.app_enable(session_browser, 'ejabberd') + functional.app_enable(session_browser, 'avahi') + functional.set_hostname(session_browser, 'freedombox') _enable_domain(session_browser, 'freedombox.local') _disable_domain(session_browser, 'freedombox.local') diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 325df70a3..5a17413af 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -463,6 +463,13 @@ def running_inside_container(): ############################## # System -> Config utilities # ############################## +def set_hostname(browser, hostname): + nav_to_module(browser, 'config') + browser.find_by_id('id_hostname').fill(hostname) + update_setup = browser.find_by_css('.btn-primary') + submit(browser, element=update_setup) + + def set_advanced_mode(browser, mode): nav_to_module(browser, 'config') advanced_mode = browser.find_by_id('id_advanced_mode')