mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
package: Implement installing packages in the component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
2157cb33b7
commit
d1b040cdb6
2 files changed
+38
-1
No files matched your search
@@ -3,13 +3,16 @@
|
||||
Test module for package module.
|
||||
"""
|
||||
|
||||
from unittest.mock import call, patch
|
||||
from unittest.mock import Mock, call, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from plinth.app import App
|
||||
from plinth.errors import ActionError
|
||||
from plinth.package import Packages, packages_installed, remove
|
||||
|
||||
setup_helper = Mock()
|
||||
|
||||
|
||||
def test_packages_init():
|
||||
"""Test initialization of packages component."""
|
||||
@@ -26,6 +29,31 @@ def test_packages_init():
|
||||
assert component.skip_recommends
|
||||
|
||||
|
||||
def test_packages_setup():
|
||||
"""Test setting up packages component."""
|
||||
|
||||
class TestApp(App):
|
||||
"""Test app"""
|
||||
app_id = 'test-app'
|
||||
|
||||
component = Packages('test-component', ['foo1', 'bar1'])
|
||||
app = TestApp()
|
||||
app.add(component)
|
||||
setup_helper.reset_mock()
|
||||
app.setup(old_version=3)
|
||||
setup_helper.install.assert_has_calls(
|
||||
[call(['foo1', 'bar1'], skip_recommends=False)])
|
||||
|
||||
component = Packages('test-component', ['foo2', 'bar2'],
|
||||
skip_recommends=True)
|
||||
app = TestApp()
|
||||
app.add(component)
|
||||
setup_helper.reset_mock()
|
||||
app.setup(old_version=3)
|
||||
setup_helper.install.assert_has_calls(
|
||||
[call(['foo2', 'bar2'], skip_recommends=True)])
|
||||
|
||||
|
||||
def test_packages_installed():
|
||||
"""Test packages_installed()."""
|
||||
# list as input
|
||||
|
||||
Reference in new issue
Block a user