mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
app: Introduce Info component to store basic app information
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
7b05d7433d
commit
72ce23e377
5 files changed
+165
-1
No files matched your search
@@ -23,7 +23,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from plinth.app import App, Component, FollowerComponent, LeaderComponent
|
||||
from plinth.app import App, Component, FollowerComponent, Info, LeaderComponent
|
||||
|
||||
|
||||
class AppTest(App):
|
||||
@@ -282,3 +282,37 @@ def test_leader_component_is_enabled():
|
||||
component = LeaderComponent('test-leader-1')
|
||||
with pytest.raises(NotImplementedError):
|
||||
assert component.is_enabled()
|
||||
|
||||
|
||||
def test_info_initialization_without_args():
|
||||
"""Test initializing the Info component without arguments."""
|
||||
info = Info('test-app', 3)
|
||||
assert info.component_id == 'test-app-info'
|
||||
assert info.app_id == 'test-app'
|
||||
assert info.version == 3
|
||||
assert not info.is_essential
|
||||
assert info.depends == []
|
||||
assert info.name is None
|
||||
assert info.icon is None
|
||||
assert info.icon_filename is None
|
||||
assert info.short_description is None
|
||||
assert info.description is None
|
||||
assert info.manual_page is None
|
||||
assert info.clients is None
|
||||
|
||||
|
||||
def test_info_initialization_with_args():
|
||||
"""Test initializing the Info component with arguments."""
|
||||
info = Info('test-app', 3, is_essential=True, depends=['test-app-2'],
|
||||
name='Test App', icon='fa-test', icon_filename='test-icon',
|
||||
short_description='For Test', description='Test description',
|
||||
manual_page='Test', clients=['test'])
|
||||
assert info.is_essential
|
||||
assert info.depends == ['test-app-2']
|
||||
assert info.name == 'Test App'
|
||||
assert info.icon == 'fa-test'
|
||||
assert info.icon_filename == 'test-icon'
|
||||
assert info.short_description == 'For Test'
|
||||
assert info.description == 'Test description'
|
||||
assert info.manual_page == 'Test'
|
||||
assert info.clients == ['test']
|
||||
Reference in new issue
Block a user