mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
mldonkey: 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
79d1588691
commit
0faff1f188
@ -1,38 +0,0 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@apps @mldonkey @sso
|
||||
Feature: MLDonkey eDonkey Network Client
|
||||
Run the eDonkey Network client.
|
||||
|
||||
Background:
|
||||
Given I'm a logged in user
|
||||
Given the mldonkey application is installed
|
||||
|
||||
Scenario: Enable mldonkey application
|
||||
Given the mldonkey application is disabled
|
||||
When I enable the mldonkey application
|
||||
Then the mldonkey service should be running
|
||||
Then the mldonkey site should be available
|
||||
|
||||
Scenario: Upload an ed2k file to mldonkey
|
||||
Given the mldonkey application is enabled
|
||||
When all ed2k files are removed from mldonkey
|
||||
And I upload a sample ed2k file to mldonkey
|
||||
Then there should be 1 ed2k files listed in mldonkey
|
||||
|
||||
@backups
|
||||
Scenario: Backup and restore mldonkey
|
||||
Given the mldonkey application is enabled
|
||||
When all ed2k files are removed from mldonkey
|
||||
And I upload a sample ed2k file to mldonkey
|
||||
And I create a backup of the mldonkey app data with name test_mldonkey
|
||||
And all ed2k files are removed from mldonkey
|
||||
And I restore the mldonkey app data backup with name test_mldonkey
|
||||
Then the mldonkey service should be running
|
||||
And there should be 1 ed2k files listed in mldonkey
|
||||
|
||||
Scenario: Disable mldonkey application
|
||||
Given the mldonkey application is enabled
|
||||
When I disable the mldonkey application
|
||||
Then the mldonkey service should not be running
|
||||
Then the mldonkey site should not be available
|
||||
@ -3,28 +3,54 @@
|
||||
Functional, browser based tests for mldonkey app.
|
||||
"""
|
||||
|
||||
from pytest_bdd import parsers, scenarios, then, when
|
||||
|
||||
import pytest
|
||||
from plinth.tests import functional
|
||||
|
||||
scenarios('mldonkey.feature')
|
||||
pytestmark = [pytest.mark.apps, pytest.mark.mldonkey]
|
||||
|
||||
|
||||
@when('all ed2k files are removed from mldonkey')
|
||||
def mldonkey_remove_all_ed2k_files(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, 'mldonkey')
|
||||
yield
|
||||
functional.app_disable(session_browser, 'mldonkey')
|
||||
|
||||
|
||||
def test_enable_disable(session_browser):
|
||||
"""Test enabling the app."""
|
||||
functional.app_disable(session_browser, 'mldonkey')
|
||||
|
||||
functional.app_enable(session_browser, 'mldonkey')
|
||||
assert functional.service_is_running(session_browser, 'mldonkey')
|
||||
assert functional.is_available(session_browser, 'mldonkey')
|
||||
|
||||
functional.app_disable(session_browser, 'mldonkey')
|
||||
assert functional.service_is_not_running(session_browser, 'mldonkey')
|
||||
assert not functional.is_available(session_browser, 'mldonkey')
|
||||
|
||||
|
||||
def test_upload(session_browser):
|
||||
"""Test uploading an ed2k file to mldonkey."""
|
||||
functional.app_enable(session_browser, 'mldonkey')
|
||||
_remove_all_ed2k_files(session_browser)
|
||||
|
||||
|
||||
@when('I upload a sample ed2k file to mldonkey')
|
||||
def mldonkey_upload_sample_ed2k_file(session_browser):
|
||||
_upload_sample_ed2k_file(session_browser)
|
||||
assert _get_number_of_ed2k_files(session_browser) == 1
|
||||
|
||||
|
||||
@then(
|
||||
parsers.parse(
|
||||
'there should be {ed2k_files_number:d} ed2k files listed in mldonkey'))
|
||||
def mldonkey_assert_number_of_ed2k_files(session_browser, ed2k_files_number):
|
||||
assert ed2k_files_number == _get_number_of_ed2k_files(session_browser)
|
||||
def test_backup_restore(session_browser):
|
||||
"""Test backup and restore of ed2k files."""
|
||||
functional.app_enable(session_browser, 'mldonkey')
|
||||
_remove_all_ed2k_files(session_browser)
|
||||
_upload_sample_ed2k_file(session_browser)
|
||||
functional.backup_create(session_browser, 'mldonkey', 'test_mldonkey')
|
||||
|
||||
_remove_all_ed2k_files(session_browser)
|
||||
functional.backup_restore(session_browser, 'mldonkey', 'test_mldonkey')
|
||||
|
||||
assert functional.service_is_running(session_browser, 'mldonkey')
|
||||
assert _get_number_of_ed2k_files(session_browser) == 1
|
||||
|
||||
|
||||
def _submit_command(browser, command):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user