ttrss: 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-04 20:18:56 -04:00 committed by Sunil Mohan Adapa
parent 79f09e3d88
commit 95a3784f02
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 29 additions and 40 deletions

View File

@ -3,25 +3,43 @@
Functional, browser based tests for ttrss app.
"""
from pytest_bdd import given, scenarios, then, when
import pytest
from plinth.tests import functional
scenarios('ttrss.feature')
pytestmark = [pytest.mark.apps, pytest.mark.ttrss, pytest.mark.sso]
@given('I subscribe to a feed in ttrss')
def ttrss_subscribe(session_browser):
@pytest.fixture(scope='module', autouse=True)
def fixture_background(session_browser):
"""Login and install the app."""
functional.login(session_browser)
functional.install(session_browser, 'ttrss')
yield
functional.app_disable(session_browser, 'ttrss')
def test_enable_disable(session_browser):
"""Test enabling the app."""
functional.app_disable(session_browser, 'ttrss')
functional.app_enable(session_browser, 'ttrss')
assert functional.service_is_running(session_browser, 'ttrss')
functional.app_disable(session_browser, 'ttrss')
assert functional.service_is_not_running(session_browser, 'ttrss')
@pytest.mark.backups
def test_backup_restore(session_browser):
"""Test backup and restore of app data."""
functional.app_enable(session_browser, 'ttrss')
_subscribe(session_browser)
functional.backup_create(session_browser, 'ttrss', 'test_ttrss')
@when('I unsubscribe from the feed in ttrss')
def ttrss_unsubscribe(session_browser):
_unsubscribe(session_browser)
functional.backup_restore(session_browser, 'ttrss', 'test_ttrss')
@then('I should be subscribed to the feed in ttrss')
def ttrss_assert_subscribed(session_browser):
assert functional.service_is_running(session_browser, 'ttrss')
assert _is_subscribed(session_browser)

View File

@ -1,29 +0,0 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
@apps @ttrss @sso
Feature: TT-RSS News Feed Reader
Run TT-RSS News Feed Reader.
Background:
Given I'm a logged in user
Given the ttrss application is installed
Scenario: Enable ttrss application
Given the ttrss application is disabled
When I enable the ttrss application
Then the ttrss service should be running
@backups
Scenario: Backup and restore ttrss
Given the ttrss application is enabled
And I subscribe to a feed in ttrss
When I create a backup of the ttrss app data with name test_ttrss
And I unsubscribe from the feed in ttrss
And I restore the ttrss app data backup with name test_ttrss
Then the ttrss service should be running
And I should be subscribed to the feed in ttrss
Scenario: Disable ttrss application
Given the ttrss application is enabled
When I disable the ttrss application
Then the ttrss service should not be running