From dc1f6ef732394ef0a273d6902fb59a64f1989889 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 6 Sep 2021 19:44:44 -0400 Subject: [PATCH] infinoted: Convert functional tests to non-BDD python format Signed-off-by: James Valleroy [sunil: Add markers] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- .../modules/infinoted/tests/infinoted.feature | 19 -------------- .../infinoted/tests/test_functional.py | 25 +++++++++++++++++-- 2 files changed, 23 insertions(+), 21 deletions(-) delete mode 100644 plinth/modules/infinoted/tests/infinoted.feature diff --git a/plinth/modules/infinoted/tests/infinoted.feature b/plinth/modules/infinoted/tests/infinoted.feature deleted file mode 100644 index 9687a6b9c..000000000 --- a/plinth/modules/infinoted/tests/infinoted.feature +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@apps @infinoted -Feature: Infinoted Collaborative Text Editor - Run Gobby Server - Infinoted - -Background: - Given I'm a logged in user - Given the infinoted application is installed - -Scenario: Enable infinoted application - Given the infinoted application is disabled - When I enable the infinoted application - Then the infinoted service should be running - -Scenario: Disable infinoted application - Given the infinoted application is enabled - When I disable the infinoted application - Then the infinoted service should not be running diff --git a/plinth/modules/infinoted/tests/test_functional.py b/plinth/modules/infinoted/tests/test_functional.py index be32e536e..eab534960 100644 --- a/plinth/modules/infinoted/tests/test_functional.py +++ b/plinth/modules/infinoted/tests/test_functional.py @@ -3,6 +3,27 @@ Functional, browser based tests for infinoted app. """ -from pytest_bdd import scenarios +import pytest +from plinth.tests import functional -scenarios('infinoted.feature') +pytestmark = [pytest.mark.apps, pytest.mark.infinoted] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.install(session_browser, 'infinoted') + yield + functional.app_disable(session_browser, 'infinoted') + + +def test_enable_disable(session_browser): + """Test enabling the app.""" + functional.app_disable(session_browser, 'infinoted') + + functional.app_enable(session_browser, 'infinoted') + assert functional.service_is_running(session_browser, 'infinoted') + + functional.app_disable(session_browser, 'infinoted') + assert functional.service_is_not_running(session_browser, 'infinoted')