mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
package: Implement uninstall in Package component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
aa94d9f622
commit
a1c6c7b6a7
@ -176,6 +176,10 @@ class Packages(app.FollowerComponent):
|
||||
install(self.get_actual_packages(),
|
||||
skip_recommends=self.skip_recommends)
|
||||
|
||||
def uninstall(self):
|
||||
"""Uninstall and purge the packages."""
|
||||
uninstall(self.get_actual_packages())
|
||||
|
||||
def diagnose(self):
|
||||
"""Run diagnostics and return results."""
|
||||
results = super().diagnose()
|
||||
|
||||
@ -114,6 +114,21 @@ def test_packages_setup(install):
|
||||
install.assert_has_calls([call(['python3'], skip_recommends=False)])
|
||||
|
||||
|
||||
@patch('plinth.package.uninstall')
|
||||
def test_packages_uninstall(uninstall):
|
||||
"""Test uninstalling packages component."""
|
||||
|
||||
class TestApp(App):
|
||||
"""Test app"""
|
||||
app_id = 'test-app'
|
||||
|
||||
component = Packages('test-component', ['python3', 'bash'])
|
||||
app = TestApp()
|
||||
app.add(component)
|
||||
app.uninstall()
|
||||
uninstall.assert_has_calls([call(['python3', 'bash'])])
|
||||
|
||||
|
||||
@patch('apt.Cache')
|
||||
def test_diagnose(cache):
|
||||
"""Test checking for latest version of the package."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user