mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
package, email: Move conflicting package removal to framework
- Warning that exim4 will be removed is incorrectly not shown during email app installation. Fix that. Tests: - Unit tests pass. - On a fresh testing container, trying to install email app shows the warning message that exim will be removed. Installing the email app succeeds. exim is removed during installation. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
bb527673fb
commit
0b9d567493
3 files changed
+39
-12
No files matched your search
@@ -114,6 +114,36 @@ def test_packages_setup(install):
|
||||
install.assert_has_calls([call(['python3'], skip_recommends=False)])
|
||||
|
||||
|
||||
@patch('plinth.package.packages_installed')
|
||||
@patch('plinth.package.uninstall')
|
||||
@patch('plinth.package.install')
|
||||
def test_packages_setup_with_conflicts(install, uninstall, packages_installed):
|
||||
"""Test setting up packages with conflicts."""
|
||||
packages_installed.return_value = ['exim4-base']
|
||||
|
||||
component = Packages('test-component', ['bash'], conflicts=['exim4-base'],
|
||||
conflicts_action=Packages.ConflictsAction.REMOVE)
|
||||
component.setup(old_version=0)
|
||||
uninstall.assert_has_calls([call(['exim4-base'])])
|
||||
install.assert_has_calls([call(['bash'], skip_recommends=False)])
|
||||
|
||||
uninstall.reset_mock()
|
||||
install.reset_mock()
|
||||
component = Packages('test-component', ['bash'], conflicts=['exim4-base'])
|
||||
component.setup(old_version=0)
|
||||
uninstall.assert_not_called()
|
||||
install.assert_has_calls([call(['bash'], skip_recommends=False)])
|
||||
|
||||
uninstall.reset_mock()
|
||||
install.reset_mock()
|
||||
component = Packages('test-component', ['bash'],
|
||||
conflicts=['exim4-base', 'not-installed-package'],
|
||||
conflicts_action=Packages.ConflictsAction.IGNORE)
|
||||
component.setup(old_version=0)
|
||||
uninstall.assert_not_called()
|
||||
install.assert_has_calls([call(['bash'], skip_recommends=False)])
|
||||
|
||||
|
||||
@patch('plinth.package.uninstall')
|
||||
def test_packages_uninstall(uninstall):
|
||||
"""Test uninstalling packages component."""
|
||||
|
||||
Reference in new issue
Block a user