feat: add apt.is_installed()
function
This commit is contained in:
parent
12daf6a1e3
commit
4dede6072c
2 changed files with 28 additions and 0 deletions
|
@ -25,6 +25,21 @@ class TestInstall(TestCase):
|
|||
c.run.assert_called_once_with('DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install postfix')
|
||||
|
||||
|
||||
class TestIsInstalled(TestCase):
|
||||
|
||||
def test_already_installed(self):
|
||||
c = MagicMock()
|
||||
c.run.return_value.ok = True
|
||||
self.assertTrue(mod.is_installed(c, 'postfix'))
|
||||
c.run.assert_called_once_with('dpkg-query -s postfix', warn=True)
|
||||
|
||||
def test_not_installed(self):
|
||||
c = MagicMock()
|
||||
c.run.return_value.ok = False
|
||||
self.assertFalse(mod.is_installed(c, 'postfix'))
|
||||
c.run.assert_called_once_with('dpkg-query -s postfix', warn=True)
|
||||
|
||||
|
||||
class TestUpdate(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue