mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
calibre: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org> [sunil: Rename the backup/restore test to override base class] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
d70dd81e21
commit
025de63ac2
@ -13,63 +13,45 @@ from plinth.tests import functional
|
|||||||
pytestmark = [pytest.mark.apps, pytest.mark.sso, pytest.mark.calibre]
|
pytestmark = [pytest.mark.apps, pytest.mark.sso, pytest.mark.calibre]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module', autouse=True)
|
class TestCalibreApp(functional.BaseAppTests):
|
||||||
def fixture_background(session_browser):
|
app_name = 'calibre'
|
||||||
"""Login and install the app."""
|
has_service = True
|
||||||
functional.login(session_browser)
|
has_web = True
|
||||||
functional.install(session_browser, 'calibre')
|
|
||||||
yield
|
|
||||||
functional.app_disable(session_browser, 'calibre')
|
|
||||||
|
|
||||||
|
def test_add_delete_library(self, session_browser):
|
||||||
|
"""Test adding/deleting a new library."""
|
||||||
|
functional.app_enable(session_browser, 'calibre')
|
||||||
|
_delete_library(session_browser, 'FunctionalTest', True)
|
||||||
|
|
||||||
def test_enable_disable(session_browser):
|
_add_library(session_browser, 'FunctionalTest')
|
||||||
"""Test enabling the app."""
|
assert _is_library_available(session_browser, 'FunctionalTest')
|
||||||
functional.app_disable(session_browser, 'calibre')
|
|
||||||
|
|
||||||
functional.app_enable(session_browser, 'calibre')
|
_delete_library(session_browser, 'FunctionalTest')
|
||||||
assert functional.service_is_running(session_browser, 'calibre')
|
assert not _is_library_available(session_browser, 'FunctionalTest')
|
||||||
assert functional.is_available(session_browser, 'calibre')
|
|
||||||
|
|
||||||
functional.app_disable(session_browser, 'calibre')
|
def test_add_delete_book(self, session_browser):
|
||||||
assert not functional.service_is_running(session_browser, 'calibre')
|
"""Test adding/delete book in the library."""
|
||||||
assert not functional.is_available(session_browser, 'calibre')
|
functional.app_enable(session_browser, 'calibre')
|
||||||
|
_add_library(session_browser, 'FunctionalTest')
|
||||||
|
_delete_book(session_browser, 'FunctionalTest', 'sample.txt', True)
|
||||||
|
|
||||||
|
_add_book(session_browser, 'FunctionalTest', 'sample.txt')
|
||||||
def test_add_delete_library(session_browser):
|
assert _is_book_available(session_browser, 'FunctionalTest',
|
||||||
"""Test adding/deleting a new library."""
|
|
||||||
functional.app_enable(session_browser, 'calibre')
|
|
||||||
_delete_library(session_browser, 'FunctionalTest', True)
|
|
||||||
|
|
||||||
_add_library(session_browser, 'FunctionalTest')
|
|
||||||
assert _is_library_available(session_browser, 'FunctionalTest')
|
|
||||||
|
|
||||||
_delete_library(session_browser, 'FunctionalTest')
|
|
||||||
assert not _is_library_available(session_browser, 'FunctionalTest')
|
|
||||||
|
|
||||||
|
|
||||||
def test_add_delete_book(session_browser):
|
|
||||||
"""Test adding/delete book in the library."""
|
|
||||||
functional.app_enable(session_browser, 'calibre')
|
|
||||||
_add_library(session_browser, 'FunctionalTest')
|
|
||||||
_delete_book(session_browser, 'FunctionalTest', 'sample.txt', True)
|
|
||||||
|
|
||||||
_add_book(session_browser, 'FunctionalTest', 'sample.txt')
|
|
||||||
assert _is_book_available(session_browser, 'FunctionalTest', 'sample.txt')
|
|
||||||
|
|
||||||
_delete_book(session_browser, 'FunctionalTest', 'sample.txt')
|
|
||||||
assert not _is_book_available(session_browser, 'FunctionalTest',
|
|
||||||
'sample.txt')
|
'sample.txt')
|
||||||
|
|
||||||
|
_delete_book(session_browser, 'FunctionalTest', 'sample.txt')
|
||||||
|
assert not _is_book_available(session_browser, 'FunctionalTest',
|
||||||
|
'sample.txt')
|
||||||
|
|
||||||
@pytest.mark.backups
|
@pytest.mark.backups
|
||||||
def test_backup(session_browser):
|
def test_backup_restore(self, session_browser):
|
||||||
"""Test backing up and restoring."""
|
"""Test backing up and restoring."""
|
||||||
functional.app_enable(session_browser, 'calibre')
|
functional.app_enable(session_browser, 'calibre')
|
||||||
_add_library(session_browser, 'FunctionalTest')
|
_add_library(session_browser, 'FunctionalTest')
|
||||||
functional.backup_create(session_browser, 'calibre', 'test_calibre')
|
functional.backup_create(session_browser, 'calibre', 'test_calibre')
|
||||||
_delete_library(session_browser, 'FunctionalTest')
|
_delete_library(session_browser, 'FunctionalTest')
|
||||||
functional.backup_restore(session_browser, 'calibre', 'test_calibre')
|
functional.backup_restore(session_browser, 'calibre', 'test_calibre')
|
||||||
assert _is_library_available(session_browser, 'FunctionalTest')
|
assert _is_library_available(session_browser, 'FunctionalTest')
|
||||||
|
|
||||||
|
|
||||||
def _add_library(browser, name):
|
def _add_library(browser, name):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user