diff --git a/plinth/modules/sso/tests/sso.feature b/plinth/modules/sso/tests/sso.feature deleted file mode 100644 index f6f0d998e..000000000 --- a/plinth/modules/sso/tests/sso.feature +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@sso @essential @system -Feature: Single Sign On - Test Single Sign On features. - -Background: - Given I'm a logged in user - Given the syncthing application is installed - Given the syncthing application is enabled - - -Scenario: Logged out Plinth user cannot access Syncthing web interface - Given I'm a logged out user - When I access syncthing application - Then I should be prompted for login - -Scenario: Logged in Plinth user can access Syncthing web interface - When I access syncthing application - Then the syncthing site should be available diff --git a/plinth/modules/sso/tests/test_functional.py b/plinth/modules/sso/tests/test_functional.py index 3af0e47eb..631853720 100644 --- a/plinth/modules/sso/tests/test_functional.py +++ b/plinth/modules/sso/tests/test_functional.py @@ -3,6 +3,28 @@ Functional, browser based tests for sso app. """ -from pytest_bdd import scenarios +import pytest +from plinth.tests import functional -scenarios('sso.feature') +pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.sso] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.install(session_browser, 'syncthing') + functional.app_enable(session_browser, 'syncthing') + yield + functional.app_disable(session_browser, 'syncthing') + + +def test_app_access(session_browser): + """Test that only logged-in users can access Syncthing web interface.""" + functional.logout(session_browser) + functional.access_url(session_browser, 'syncthing') + assert functional.is_login_prompt(session_browser) + + functional.login(session_browser) + functional.access_url(session_browser, 'syncthing') + assert functional.is_available(session_browser, 'syncthing')