Use assertIn to check whether substring is in str

This is to use assertIn to check whether substring is in str,
go get clearer failure message.

Change-Id: I40aff29454c423389755a5330751d2f69a227a05
This commit is contained in:
zhufl 2019-04-15 15:12:30 +08:00
parent 5090a15f52
commit 65d3cb75f8
1 changed files with 2 additions and 2 deletions

View File

@ -678,7 +678,7 @@ class TestAuditor(unittest.TestCase):
auditor_worker.audit_all_objects(device_dirs=['sda'])
log_lines = self.logger.get_lines_for_level('info')
self.assertGreater(len(log_lines), 0)
self.assertTrue(log_lines[0].index('ALL - parallel, sda'))
self.assertIn('ALL - parallel, sda', log_lines[0])
self.logger.clear()
auditor_worker = auditor.AuditorWorker(self.conf, self.logger,
@ -687,7 +687,7 @@ class TestAuditor(unittest.TestCase):
auditor_worker.audit_all_objects(device_dirs=['sda'])
log_lines = self.logger.get_lines_for_level('info')
self.assertGreater(len(log_lines), 0)
self.assertTrue(log_lines[0].index('ZBF - sda'))
self.assertIn('ZBF - sda', log_lines[0])
def test_object_run_recon_cache(self):
ts = Timestamp(time.time())