zoph: 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-21 20:17:08 -04:00 committed by Sunil Mohan Adapa
parent 017b1b43da
commit a503d5db5d
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -9,39 +9,29 @@ from plinth.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.zoph]
@pytest.fixture(scope='module', autouse=True)
def fixture_background(session_browser):
"""Login and install the app."""
functional.login(session_browser)
functional.install(session_browser, 'zoph')
_zoph_is_setup(session_browser)
yield
functional.app_disable(session_browser, 'zoph')
class TestZophApp(functional.BaseAppTests):
app_name = 'zoph'
has_service = False
has_web = True
@pytest.fixture(scope='class', autouse=True)
def fixture_background(self, session_browser):
"""Login and install the app."""
functional.login(session_browser)
functional.install(session_browser, self.app_name)
self._zoph_is_setup(session_browser)
yield
functional.app_disable(session_browser, self.app_name)
def test_enable_disable(session_browser):
"""Test enabling the app."""
functional.app_disable(session_browser, 'zoph')
def _zoph_is_setup(self, session_browser):
"""Click setup button on the setup page."""
functional.nav_to_module(session_browser, self.app_name)
button = session_browser.find_by_css('input[name="zoph_setup"]')
if button:
functional.submit(session_browser, element=button)
functional.app_enable(session_browser, 'zoph')
assert functional.app_is_enabled(session_browser, 'zoph')
def assert_app_running(self, session_browser):
assert functional.app_is_enabled(session_browser, self.app_name)
functional.app_disable(session_browser, 'zoph')
assert not functional.app_is_enabled(session_browser, 'zoph')
@pytest.mark.backups
def test_backup_restore(session_browser):
"""Test backup and restore."""
functional.app_enable(session_browser, 'zoph')
functional.backup_create(session_browser, 'zoph', 'test_zoph')
functional.backup_restore(session_browser, 'zoph', 'test_zoph')
assert functional.app_is_enabled(session_browser, 'zoph')
def _zoph_is_setup(session_browser):
"""Click setup button on the setup page."""
functional.nav_to_module(session_browser, 'zoph')
button = session_browser.find_by_css('input[name="zoph_setup"]')
if button:
functional.submit(session_browser, element=button)
def assert_app_not_running(self, session_browser):
assert not functional.app_is_enabled(session_browser, self.app_name)