diff --git a/plinth/modules/mumble/tests/test_functional.py b/plinth/modules/mumble/tests/test_functional.py index 4a9912f2e..83cd6ef91 100644 --- a/plinth/modules/mumble/tests/test_functional.py +++ b/plinth/modules/mumble/tests/test_functional.py @@ -18,15 +18,38 @@ class TestMumbleApp(functional.BaseAppTests): # TODO: Requires a valid domain with certificates to complete setup. check_diagnostics = False - # TODO: Improve test_backup_restore to actually check that data such - # as rooms, identity or certificates are restored. + @staticmethod + def test_change_root_channel_name(session_browser): + """Test changing root channel name.""" + functional.set_app_form_value(session_browser, 'mumble', + 'id_root_channel_name', 'test-channel') + assert session_browser.find_by_id( + 'id_root_channel_name').value == 'test-channel' - def test_change_root_channel_name(self, session_browser): - functional.app_enable(session_browser, 'mumble') - functional.nav_to_module(session_browser, 'mumble') - session_browser.find_by_id('id_root_channel_name').fill('testing123') - functional.submit(session_browser, form_class='form-configuration') + @staticmethod + def test_set_super_user_password(session_browser): + """Test setting the super user password.""" + functional.set_app_form_value(session_browser, 'mumble', + 'id_super_user_password', 'testsu123') + @staticmethod + def test_set_join_password(session_browser): + """Test setting join password.""" + functional.set_app_form_value(session_browser, 'mumble', + 'id_join_password', 'testjoin123') + + @pytest.mark.backups + def test_backup_restore(self, session_browser): + """Test that backup and restore operations work on the app.""" + functional.set_app_form_value(session_browser, 'mumble', + 'id_root_channel_name', 'pre-backup') + functional.backup_create(session_browser, self.app_name, + 'test_' + self.app_name) + functional.set_app_form_value(session_browser, 'mumble', + 'id_root_channel_name', 'post-backup') + functional.backup_restore(session_browser, self.app_name, + 'test_' + self.app_name) functional.nav_to_module(session_browser, 'mumble') assert session_browser.find_by_id( - 'id_root_channel_name').value == 'testing123' + 'id_root_channel_name').value == 'pre-backup' + self.assert_app_running(session_browser) diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 651df6081..07eebec29 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -203,6 +203,17 @@ def submit(browser, element=None, form_class=None, expected_url=None): browser.find_by_css('input[type=submit]').click() +def set_app_form_value(browser, app_id, element_id, value): + """Change a value in the form and submit.""" + nav_to_module(browser, app_id) + original_url = browser.url + browser.find_by_id(element_id).fill(value) + submit(browser, form_class='form-configuration') + # Check that there are no errors + assert browser.url == original_url + assert not browser.find_by_css('.alert-danger') + + def change_checkbox_status(browser, app_name, checkbox_id, change_status_to='enabled'): """Change checkbox status."""