diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index c0f5ac7d..6eb58133 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -45,7 +45,7 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() client_args = { "original_image_conf": original_image_conf, "image_conf": { @@ -137,7 +137,7 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() server_args = { "original_image_conf": original_image_conf, "image_conf": { @@ -196,7 +196,7 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() server_args = { "original_image_conf": original_image_conf, "image_conf": { @@ -261,8 +261,8 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertFalse(phase.pool.add.called) - self.assertFalse(phase.pool.queue_put.called) + phase.pool.add.assert_not_called() + phase.pool.queue_put.assert_not_called() @mock.patch("pungi.phases.image_build.ThreadPool") def test_image_build_set_install_tree(self, ThreadPool): @@ -297,9 +297,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual(args[0][0], compose) self.assertDictEqual( @@ -364,9 +364,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual(args[0][0], compose) self.assertDictEqual( @@ -430,9 +430,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual(args[0][0], compose) self.assertDictEqual( @@ -501,9 +501,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual(args[0][0], compose) self.assertDictEqual( @@ -569,9 +569,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual( args[0][1].get("image_conf", {}).get("image-build", {}).get("release"), @@ -612,9 +612,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertEqual( args[0][1].get("image_conf", {}).get("image-build", {}).get("release"), @@ -655,9 +655,9 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() - self.assertTrue(phase.pool.queue_put.called_once) + phase.pool.queue_put.assert_called_once() args, kwargs = phase.pool.queue_put.call_args self.assertTrue(args[0][1].get("scratch")) @@ -692,7 +692,7 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() server_args = { "original_image_conf": original_image_conf, "image_conf": { @@ -755,7 +755,7 @@ class TestImageBuildPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() server_args = { "original_image_conf": original_image_conf, "image_conf": { diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py index d459c9b9..acade8e6 100644 --- a/tests/test_liveimagesphase.py +++ b/tests/test_liveimagesphase.py @@ -43,7 +43,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -124,7 +124,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -192,7 +192,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -265,7 +265,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -363,7 +363,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -433,7 +433,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -503,7 +503,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, @@ -571,7 +571,7 @@ class TestLiveImagesPhase(PungiTestCase): phase.run() # assert at least one thread was started - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.maxDiff = None six.assertCountEqual( self, diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index 7a406716..9eea3374 100644 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -36,7 +36,7 @@ class TestLiveMediaPhase(PungiTestCase): phase = LiveMediaPhase(compose) phase.run() - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.assertEqual( phase.pool.queue_put.call_args_list, [ @@ -93,7 +93,7 @@ class TestLiveMediaPhase(PungiTestCase): phase = LiveMediaPhase(compose) phase.run() - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.assertEqual( phase.pool.queue_put.call_args_list, [ @@ -156,7 +156,7 @@ class TestLiveMediaPhase(PungiTestCase): phase = LiveMediaPhase(compose) phase.run() - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.assertEqual( phase.pool.queue_put.call_args_list, [ @@ -267,7 +267,7 @@ class TestLiveMediaPhase(PungiTestCase): phase = LiveMediaPhase(compose) phase.run() - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.assertEqual( phase.pool.queue_put.call_args_list, [ @@ -444,7 +444,7 @@ class TestLiveMediaPhase(PungiTestCase): phase = LiveMediaPhase(compose) phase.run() - self.assertTrue(phase.pool.add.called) + phase.pool.add.assert_called() self.assertEqual( phase.pool.queue_put.call_args_list, diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 914d6314..2273add2 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -133,7 +133,7 @@ class TestNotifier(unittest.TestCase): def test_does_not_run_without_config(self, run, makedirs): n = PungiNotifier(None) n.send("cmd", foo="bar", baz="quux") - self.assertFalse(run.called) + run.assert_not_called() @mock.patch("pungi.util.translate_path") @mock.patch("kobo.shortcuts.run") @@ -146,4 +146,4 @@ class TestNotifier(unittest.TestCase): n.send("cmd", **self.data) self.assertEqual(run.call_args_list, [self._call("run-notify", "cmd")]) - self.assertTrue(self.compose.log_warning.called) + self.compose.log_warning.assert_called()