mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
package: Implement low-level methods for uninstalling
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
145b3ecc65
commit
1908bd5366
4 files changed
+57
-33
No files matched your search
@@ -9,8 +9,8 @@ from unittest.mock import Mock, call, patch
|
||||
import pytest
|
||||
|
||||
from plinth.app import App
|
||||
from plinth.errors import ActionError, MissingPackageError
|
||||
from plinth.package import Package, Packages, packages_installed, remove
|
||||
from plinth.errors import MissingPackageError
|
||||
from plinth.package import Package, Packages, packages_installed
|
||||
|
||||
|
||||
class TestPackageExpressions(unittest.TestCase):
|
||||
@@ -54,7 +54,7 @@ def test_packages_init():
|
||||
assert component.possible_packages == ['foo', 'bar']
|
||||
assert component.component_id == 'test-component'
|
||||
assert not component.skip_recommends
|
||||
assert component.conflicts is None
|
||||
assert component.conflicts == []
|
||||
assert component.conflicts_action is None
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
@@ -189,17 +189,3 @@ def test_packages_installed():
|
||||
assert len(packages_installed(())) == 0
|
||||
assert len(packages_installed(('unknown-package', ))) == 0
|
||||
assert len(packages_installed(('python3', ))) == 1
|
||||
|
||||
|
||||
@patch('plinth.actions.superuser_run')
|
||||
def test_remove(run):
|
||||
"""Test removing packages."""
|
||||
remove(['package1', 'package2'])
|
||||
run.assert_has_calls(
|
||||
[call('packages', ['remove', '--packages', 'package1', 'package2'])])
|
||||
|
||||
run.reset_mock()
|
||||
run.side_effect = ActionError()
|
||||
remove(['package1'])
|
||||
run.assert_has_calls(
|
||||
[call('packages', ['remove', '--packages', 'package1'])])
|
||||
Reference in new issue
Block a user