[checks] Test printing in all cases

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-03-10 12:47:49 +01:00
parent 19468dda77
commit 3174f06fd5

View File

@ -43,10 +43,12 @@ class CheckDependenciesTestCase(unittest.TestCase):
'create_jigdo': False 'create_jigdo': False
} }
with mock.patch('os.path.exists') as exists: with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
exists.side_effect = self.dont_find(['/usr/bin/jigdo-lite']) with mock.patch('os.path.exists') as exists:
result = checks.check(conf) exists.side_effect = self.dont_find(['/usr/bin/jigdo-lite'])
result = checks.check(conf)
self.assertEqual('', out.getvalue())
self.assertTrue(result) self.assertTrue(result)
def test_isohybrid_not_required_without_productimg_phase(self): def test_isohybrid_not_required_without_productimg_phase(self):
@ -56,10 +58,12 @@ class CheckDependenciesTestCase(unittest.TestCase):
'runroot': True, 'runroot': True,
} }
with mock.patch('os.path.exists') as exists: with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
exists.side_effect = self.dont_find(['/usr/bin/isohybrid']) with mock.patch('os.path.exists') as exists:
result = checks.check(conf) exists.side_effect = self.dont_find(['/usr/bin/isohybrid'])
result = checks.check(conf)
self.assertEqual('', out.getvalue())
self.assertTrue(result) self.assertTrue(result)
def test_isohybrid_not_required_on_not_bootable(self): def test_isohybrid_not_required_on_not_bootable(self):
@ -68,10 +72,12 @@ class CheckDependenciesTestCase(unittest.TestCase):
'runroot': True, 'runroot': True,
} }
with mock.patch('os.path.exists') as exists: with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
exists.side_effect = self.dont_find(['/usr/bin/isohybrid']) with mock.patch('os.path.exists') as exists:
result = checks.check(conf) exists.side_effect = self.dont_find(['/usr/bin/isohybrid'])
result = checks.check(conf)
self.assertEqual('', out.getvalue())
self.assertTrue(result) self.assertTrue(result)
def test_isohybrid_not_required_on_arm(self): def test_isohybrid_not_required_on_arm(self):
@ -96,10 +102,12 @@ class CheckDependenciesTestCase(unittest.TestCase):
'runroot': True, 'runroot': True,
} }
with mock.patch('os.path.exists') as exists: with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
exists.side_effect = self.dont_find(['/usr/bin/isohybrid']) with mock.patch('os.path.exists') as exists:
result = checks.check(conf) exists.side_effect = self.dont_find(['/usr/bin/isohybrid'])
result = checks.check(conf)
self.assertEqual('', out.getvalue())
self.assertTrue(result) self.assertTrue(result)
def test_genisoimg_not_needed_in_runroot(self): def test_genisoimg_not_needed_in_runroot(self):
@ -107,10 +115,12 @@ class CheckDependenciesTestCase(unittest.TestCase):
'runroot': True, 'runroot': True,
} }
with mock.patch('os.path.exists') as exists: with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
exists.side_effect = self.dont_find(['/usr/bin/genisoimage']) with mock.patch('os.path.exists') as exists:
result = checks.check(conf) exists.side_effect = self.dont_find(['/usr/bin/genisoimage'])
result = checks.check(conf)
self.assertEqual('', out.getvalue())
self.assertTrue(result) self.assertTrue(result)
def test_genisoimg_needed_for_productimg(self): def test_genisoimg_needed_for_productimg(self):