mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
ejabberd: 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
db32e885d9
commit
373bda1133
@ -1,41 +0,0 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
# TODO Check service
|
|
||||||
# TODO Check domain name display
|
|
||||||
|
|
||||||
@apps @ejabberd
|
|
||||||
Feature: Ejabberd Chat Server
|
|
||||||
Run ejabberd chat server.
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given I'm a logged in user
|
|
||||||
Given the ejabberd application is installed
|
|
||||||
|
|
||||||
Scenario: Enable ejabberd application
|
|
||||||
Given the ejabberd application is disabled
|
|
||||||
When I enable the ejabberd application
|
|
||||||
Then the ejabberd service should be running
|
|
||||||
|
|
||||||
Scenario: Enable message archive management
|
|
||||||
Given the ejabberd application is enabled
|
|
||||||
When I enable message archive management
|
|
||||||
Then the ejabberd service should be running
|
|
||||||
|
|
||||||
Scenario: Disable message archive management
|
|
||||||
Given the ejabberd application is enabled
|
|
||||||
When I disable message archive management
|
|
||||||
Then the ejabberd service should be running
|
|
||||||
|
|
||||||
@backups
|
|
||||||
Scenario: Backup and restore ejabberd
|
|
||||||
Given the ejabberd application is enabled
|
|
||||||
And I have added a contact to my roster
|
|
||||||
When I create a backup of the ejabberd app data with name test_ejabberd
|
|
||||||
And I delete the contact from my roster
|
|
||||||
And I restore the ejabberd app data backup with name test_ejabberd
|
|
||||||
Then I should have a contact on my roster
|
|
||||||
|
|
||||||
Scenario: Disable ejabberd application
|
|
||||||
Given the ejabberd application is enabled
|
|
||||||
When I disable the ejabberd application
|
|
||||||
Then the ejabberd service should not be running
|
|
||||||
@ -3,36 +3,56 @@
|
|||||||
Functional, browser based tests for ejabberd app.
|
Functional, browser based tests for ejabberd app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pytest_bdd import given, parsers, scenarios, then, when
|
import pytest
|
||||||
|
|
||||||
from plinth.tests import functional
|
from plinth.tests import functional
|
||||||
|
|
||||||
scenarios('ejabberd.feature')
|
pytestmark = [pytest.mark.apps, pytest.mark.ejabberd]
|
||||||
|
|
||||||
|
# TODO Check service
|
||||||
|
# TODO Check domain name display
|
||||||
|
|
||||||
|
|
||||||
@given('I have added a contact to my roster')
|
@pytest.fixture(scope='module', autouse=True)
|
||||||
def ejabberd_add_contact(session_browser):
|
def fixture_background(session_browser):
|
||||||
_jsxc_add_contact(session_browser)
|
"""Login and install the app."""
|
||||||
|
functional.login(session_browser)
|
||||||
|
functional.install(session_browser, 'ejabberd')
|
||||||
|
yield
|
||||||
|
functional.app_disable(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
|
||||||
@when('I delete the contact from my roster')
|
def test_enable_disable(session_browser):
|
||||||
def ejabberd_delete_contact(session_browser):
|
"""Test enabling the app."""
|
||||||
_jsxc_delete_contact(session_browser)
|
functional.app_disable(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
functional.app_enable(session_browser, 'ejabberd')
|
||||||
|
assert functional.service_is_running(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
functional.app_disable(session_browser, 'ejabberd')
|
||||||
|
assert functional.service_is_not_running(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
|
||||||
@then('I should have a contact on my roster')
|
def test_message_archive_management(session_browser):
|
||||||
def ejabberd_should_have_contact(session_browser):
|
"""Test enabling message archive management."""
|
||||||
_jsxc_assert_has_contact(session_browser)
|
functional.app_enable(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
|
||||||
@when(parsers.parse('I enable message archive management'))
|
|
||||||
def ejabberd_enable_archive_management(session_browser):
|
|
||||||
_enable_message_archive_management(session_browser)
|
_enable_message_archive_management(session_browser)
|
||||||
|
assert functional.service_is_running(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
|
||||||
@when(parsers.parse('I disable message archive management'))
|
|
||||||
def ejabberd_disable_archive_management(session_browser):
|
|
||||||
_disable_message_archive_management(session_browser)
|
_disable_message_archive_management(session_browser)
|
||||||
|
assert functional.service_is_running(session_browser, 'ejabberd')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.backups
|
||||||
|
def test_backup_restore(session_browser):
|
||||||
|
"""Test backup and restore of app data."""
|
||||||
|
functional.app_enable(session_browser, 'ejabberd')
|
||||||
|
_jsxc_add_contact(session_browser)
|
||||||
|
functional.backup_create(session_browser, 'ejabberd', 'test_ejabberd')
|
||||||
|
|
||||||
|
_jsxc_delete_contact(session_browser)
|
||||||
|
functional.backup_restore(session_browser, 'ejabberd', 'test_ejabberd')
|
||||||
|
|
||||||
|
_jsxc_assert_has_contact(session_browser)
|
||||||
|
|
||||||
|
|
||||||
def _enable_message_archive_management(browser):
|
def _enable_message_archive_management(browser):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user