fix: format all code with black

and from now on should not deviate from that...
This commit is contained in:
Lance Edgar 2025-08-31 12:52:36 -05:00
parent 2bd094b10b
commit 147d2fd871
17 changed files with 298 additions and 216 deletions

View file

@ -10,19 +10,23 @@ class TestDistUpgrade(TestCase):
def test_basic(self):
c = MagicMock()
with patch.object(mod, 'update') as update:
with patch.object(mod, 'upgrade') as upgrade:
mod.dist_upgrade(c, frontend='whatever')
with patch.object(mod, "update") as update:
with patch.object(mod, "upgrade") as upgrade:
mod.dist_upgrade(c, frontend="whatever")
update.assert_called_once_with(c)
upgrade.assert_called_once_with(c, dist_upgrade=True, frontend='whatever')
upgrade.assert_called_once_with(
c, dist_upgrade=True, frontend="whatever"
)
class TestInstall(TestCase):
def test_basic(self):
c = MagicMock()
mod.install(c, 'postfix')
c.run.assert_called_once_with('DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install postfix')
mod.install(c, "postfix")
c.run.assert_called_once_with(
"DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install postfix"
)
class TestIsInstalled(TestCase):
@ -30,14 +34,14 @@ 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)
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)
self.assertFalse(mod.is_installed(c, "postfix"))
c.run.assert_called_once_with("dpkg-query -s postfix", warn=True)
class TestUpdate(TestCase):
@ -45,7 +49,7 @@ class TestUpdate(TestCase):
def test_basic(self):
c = MagicMock()
mod.update(c)
c.run.assert_called_once_with('apt-get update')
c.run.assert_called_once_with("apt-get update")
class TestUpgrade(TestCase):
@ -53,4 +57,6 @@ class TestUpgrade(TestCase):
def test_basic(self):
c = MagicMock()
mod.upgrade(c)
c.run.assert_called_once_with('DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold" upgrade')
c.run.assert_called_once_with(
'DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold" upgrade'
)