mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
pagekite: 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:
parent
8dea7d3c79
commit
98cc6c4753
@ -1,44 +0,0 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
# TODO Scenario: Enable standard services
|
|
||||||
# TODO Scenario: Disable standard services
|
|
||||||
# TODO Scenario: Add custom service
|
|
||||||
# TODO Scenario: Delete custom service
|
|
||||||
|
|
||||||
@apps @pagekite
|
|
||||||
Feature: Pagekite Public Visibility
|
|
||||||
Configure Pagekite public visitbility server.
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given I'm a logged in user
|
|
||||||
Given the pagekite application is installed
|
|
||||||
|
|
||||||
Scenario: Enable pagekite application
|
|
||||||
Given the pagekite application is disabled
|
|
||||||
When I enable the pagekite application
|
|
||||||
Then the pagekite service should be running
|
|
||||||
|
|
||||||
Scenario: Configure pagekite application
|
|
||||||
Given the pagekite application is enabled
|
|
||||||
When I configure pagekite with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
|
|
||||||
Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
|
|
||||||
|
|
||||||
Scenario: Capitalized kite name
|
|
||||||
Given the pagekite application is enabled
|
|
||||||
When I configure pagekite with host pagekite.example.com, port 8080, kite name Mykite.example.com and kite secret mysecret
|
|
||||||
Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
|
|
||||||
|
|
||||||
@backups
|
|
||||||
Scenario: Backup and restore pagekite
|
|
||||||
Given the pagekite application is enabled
|
|
||||||
When I configure pagekite with host beforebackup.example.com, port 8081, kite name beforebackup.example.com and kite secret beforebackupsecret
|
|
||||||
And I create a backup of the pagekite app data with name test_pagekite
|
|
||||||
And I configure pagekite with host afterbackup.example.com, port 8082, kite name afterbackup.example.com and kite secret afterbackupsecret
|
|
||||||
And I restore the pagekite app data backup with name test_pagekite
|
|
||||||
Then the pagekite service should be running
|
|
||||||
And pagekite should be configured with host beforebackup.example.com, port 8081, kite name beforebackup.example.com and kite secret beforebackupsecret
|
|
||||||
|
|
||||||
Scenario: Disable pagekite application
|
|
||||||
Given the pagekite application is enabled
|
|
||||||
When I disable the pagekite application
|
|
||||||
Then the pagekite service should not be running
|
|
||||||
@ -3,28 +3,66 @@
|
|||||||
Functional, browser based tests for pagekite app.
|
Functional, browser based tests for pagekite app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pytest_bdd import parsers, scenarios, then, when
|
import pytest
|
||||||
|
|
||||||
from plinth.tests import functional
|
from plinth.tests import functional
|
||||||
|
|
||||||
scenarios('pagekite.feature')
|
pytestmark = [pytest.mark.system, pytest.mark.pagekite]
|
||||||
|
|
||||||
|
# TODO Scenario: Enable standard services
|
||||||
|
# TODO Scenario: Disable standard services
|
||||||
|
# TODO Scenario: Add custom service
|
||||||
|
# TODO Scenario: Delete custom service
|
||||||
|
|
||||||
|
|
||||||
@when(
|
@pytest.fixture(scope='module', autouse=True)
|
||||||
parsers.parse('I configure pagekite with host {host:S}, port {port:d}, '
|
def fixture_background(session_browser):
|
||||||
'kite name {kite_name:S} and kite secret {kite_secret:w}'))
|
"""Login and install the app."""
|
||||||
def pagekite_configure(session_browser, host, port, kite_name, kite_secret):
|
functional.login(session_browser)
|
||||||
_configure(session_browser, host, port, kite_name, kite_secret)
|
functional.install(session_browser, 'pagekite')
|
||||||
|
yield
|
||||||
|
functional.app_disable(session_browser, 'pagekite')
|
||||||
|
|
||||||
|
|
||||||
@then(
|
def test_enable_disable(session_browser):
|
||||||
parsers.parse(
|
"""Test enabling the app."""
|
||||||
'pagekite should be configured with host {host:S}, port {port:d}, '
|
functional.app_disable(session_browser, 'pagekite')
|
||||||
'kite name {kite_name:S} and kite secret {kite_secret:w}'))
|
|
||||||
def pagekite_assert_configured(session_browser, host, port, kite_name,
|
functional.app_enable(session_browser, 'pagekite')
|
||||||
kite_secret):
|
assert functional.service_is_running(session_browser, 'pagekite')
|
||||||
assert (host, port, kite_name,
|
|
||||||
kite_secret) == _get_configuration(session_browser)
|
functional.app_disable(session_browser, 'pagekite')
|
||||||
|
assert functional.service_is_not_running(session_browser, 'pagekite')
|
||||||
|
|
||||||
|
|
||||||
|
def test_configure(session_browser):
|
||||||
|
"""Test pagekite configuration."""
|
||||||
|
functional.app_enable(session_browser, 'pagekite')
|
||||||
|
_configure(session_browser, 'pagekite.example.com', 8080,
|
||||||
|
'mykite.example.com', 'mysecret')
|
||||||
|
assert ('pagekite.example.com', 8080, 'mykite.example.com',
|
||||||
|
'mysecret') == _get_configuration(session_browser)
|
||||||
|
|
||||||
|
# Capitalized kite name should become lower case.
|
||||||
|
_configure(session_browser, 'pagekite.example.com', 8080,
|
||||||
|
'Mykite.example.com', 'mysecret')
|
||||||
|
assert ('pagekite.example.com', 8080, 'mykite.example.com',
|
||||||
|
'mysecret') == _get_configuration(session_browser)
|
||||||
|
|
||||||
|
|
||||||
|
def test_backup_restore(session_browser):
|
||||||
|
"""Test backup and restore of configuration."""
|
||||||
|
functional.app_enable(session_browser, 'pagekite')
|
||||||
|
_configure(session_browser, 'beforebackup.example.com', 8081,
|
||||||
|
'beforebackup.example.com', 'beforebackupsecret')
|
||||||
|
functional.backup_create(session_browser, 'pagekite', 'test_pagekite')
|
||||||
|
|
||||||
|
_configure(session_browser, 'afterbackup.example.com', 8082,
|
||||||
|
'afterbackup.example.com', 'afterbackupsecret')
|
||||||
|
functional.backup_restore(session_browser, 'pagekite', 'test_pagekite')
|
||||||
|
|
||||||
|
assert functional.service_is_running(session_browser, 'pagekite')
|
||||||
|
assert ('beforebackup.example.com', 8081, 'beforebackup.example.com',
|
||||||
|
'beforebackupsecret') == _get_configuration(session_browser)
|
||||||
|
|
||||||
|
|
||||||
def _configure(browser, host, port, kite_name, kite_secret):
|
def _configure(browser, host, port, kite_name, kite_secret):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user