From 9735a9d3428876a090434f3fdeb3ce8c9840ea59 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Wed, 20 Oct 2021 13:01:47 -0400 Subject: [PATCH] matrixsynapse: Use BaseAppTests for functional tests Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- .../matrixsynapse/tests/test_functional.py | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/plinth/modules/matrixsynapse/tests/test_functional.py b/plinth/modules/matrixsynapse/tests/test_functional.py index 74a3efb95..7835368dd 100644 --- a/plinth/modules/matrixsynapse/tests/test_functional.py +++ b/plinth/modules/matrixsynapse/tests/test_functional.py @@ -4,30 +4,31 @@ Functional, browser based tests for matrixsynapse app. """ import pytest +import time from plinth.tests import functional pytestmark = [pytest.mark.apps, pytest.mark.matrixsynapse] -@pytest.fixture(scope='module', autouse=True) -def fixture_background(session_browser): - """Login and install the app.""" - functional.login(session_browser) - functional.set_domain_name(session_browser, 'mydomain.example') - functional.install(session_browser, 'matrixsynapse') - functional.app_select_domain_name(session_browser, 'matrixsynapse', - 'mydomain.example') - yield - functional.app_disable(session_browser, 'matrixsynapse') +class TestMatrixSynapseApp(functional.BaseAppTests): + app_name = 'matrixsynapse' + has_service = True + has_web = False + @pytest.fixture(scope='class', autouse=True) + def fixture_background(self, session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.set_domain_name(session_browser, 'mydomain.example') + functional.install(session_browser, self.app_name) + functional.app_select_domain_name(session_browser, self.app_name, + 'mydomain.example') + yield + functional.app_disable(session_browser, self.app_name) -def test_enable_disable(session_browser): - """Test enabling the app.""" - functional.app_disable(session_browser, 'matrixsynapse') - - functional.app_enable(session_browser, 'matrixsynapse') - assert functional.service_is_running(session_browser, 'matrixsynapse') - - functional.app_disable(session_browser, 'matrixsynapse') - assert functional.service_is_not_running(session_browser, 'matrixsynapse') + def test_run_diagnostics(self, session_browser): + """Add a short delay before checking diagnostics.""" + functional.app_enable(session_browser, self.app_name) + time.sleep(1) + super().test_run_diagnostics(session_browser)