sso: Convert functional tests to non-BDD python format

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-03 11:39:58 -04:00 committed by Sunil Mohan Adapa
parent f8258fcef4
commit 667f2575b6
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 24 additions and 22 deletions

View File

@ -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

View File

@ -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')