FreedomBox/plinth/modules/sso/tests/test_functional.py
James Valleroy 667f2575b6
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>
2021-10-05 15:23:06 -07:00

31 lines
991 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Functional, browser based tests for sso app.
"""
import pytest
from plinth.tests import functional
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')