matrixsynapse: Use BaseAppTests for functional tests

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2021-10-20 13:01:47 -04:00 committed by Sunil Mohan Adapa
parent b6caa66558
commit 9735a9d342
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -4,30 +4,31 @@ Functional, browser based tests for matrixsynapse app.
""" """
import pytest import pytest
import time
from plinth.tests import functional from plinth.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.matrixsynapse] pytestmark = [pytest.mark.apps, pytest.mark.matrixsynapse]
@pytest.fixture(scope='module', autouse=True) class TestMatrixSynapseApp(functional.BaseAppTests):
def fixture_background(session_browser): app_name = 'matrixsynapse'
"""Login and install the app.""" has_service = True
functional.login(session_browser) has_web = False
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')
@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): def test_run_diagnostics(self, session_browser):
"""Test enabling the app.""" """Add a short delay before checking diagnostics."""
functional.app_disable(session_browser, 'matrixsynapse') functional.app_enable(session_browser, self.app_name)
time.sleep(1)
functional.app_enable(session_browser, 'matrixsynapse') super().test_run_diagnostics(session_browser)
assert functional.service_is_running(session_browser, 'matrixsynapse')
functional.app_disable(session_browser, 'matrixsynapse')
assert functional.service_is_not_running(session_browser, 'matrixsynapse')