From fd3166442f9b070881dbed71e35d97e13f1b764b Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 16 Aug 2022 12:21:23 -0400 Subject: [PATCH] ejabberd: Set hostname for test that relies on it The test uses freedombox.local as the domain. This requires that Avahi is enabled, and the hostname is set to freedombox. Fixes #2232. Test: - ejabberd functional tests pass even after running tests for config and avahi. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/modules/config/tests/test_functional.py | 9 +-------- plinth/modules/ejabberd/tests/test_functional.py | 2 ++ plinth/tests/functional/__init__.py | 7 +++++++ 3 files changed, 10 insertions(+), 8 deletions(-) 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')