From 8daa9aa49d55dd217c33d011c08c99b33872c72e Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Thu, 30 Sep 2021 12:08:12 -0400 Subject: [PATCH] quassel: Convert functional tests to non-BDD python format Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/modules/quassel/tests/quassel.feature | 27 -------------- .../modules/quassel/tests/test_functional.py | 36 +++++++++++++++++-- 2 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 plinth/modules/quassel/tests/quassel.feature diff --git a/plinth/modules/quassel/tests/quassel.feature b/plinth/modules/quassel/tests/quassel.feature deleted file mode 100644 index 2012ed0cc..000000000 --- a/plinth/modules/quassel/tests/quassel.feature +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@apps @quassel -Feature: Quassel IRC Client - Run Quassel core. - -Background: - Given I'm a logged in user - Given the quassel application is installed - -Scenario: Enable quassel application - Given the quassel application is disabled - When I enable the quassel application - Then the quassel service should be running - -# TODO: Improve this to actually check that data configured servers is restored. -@backups -Scenario: Backup and restore quassel - Given the quassel application is enabled - When I create a backup of the quassel app data with name test_quassel - And I restore the quassel app data backup with name test_quassel - Then the quassel service should be running - -Scenario: Disable quassel application - Given the quassel application is enabled - When I disable the quassel application - Then the quassel service should not be running diff --git a/plinth/modules/quassel/tests/test_functional.py b/plinth/modules/quassel/tests/test_functional.py index a9ddd2f57..e24faa699 100644 --- a/plinth/modules/quassel/tests/test_functional.py +++ b/plinth/modules/quassel/tests/test_functional.py @@ -3,6 +3,38 @@ Functional, browser based tests for quassel app. """ -from pytest_bdd import scenarios +import pytest +from plinth.tests import functional -scenarios('quassel.feature') +pytestmark = [pytest.mark.apps, pytest.mark.quassel] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.install(session_browser, 'quassel') + yield + functional.app_disable(session_browser, 'quassel') + + +def test_enable_disable(session_browser): + """Test enabling the app.""" + functional.app_disable(session_browser, 'quassel') + + functional.app_enable(session_browser, 'quassel') + assert functional.service_is_running(session_browser, 'quassel') + + functional.app_disable(session_browser, 'quassel') + assert functional.service_is_not_running(session_browser, 'quassel') + + +# TODO: Improve this to actually check that data configured servers is +# restored. +@pytest.mark.backups +def test_backup_restore(session_browser): + """Test backup and restore of app data.""" + functional.app_enable(session_browser, 'quassel') + functional.backup_create(session_browser, 'quassel', 'test_quassel') + functional.backup_restore(session_browser, 'quassel', 'test_quassel') + assert functional.service_is_running(session_browser, 'quassel')