Fix misuse of assertTrue
Replace assertTrue with assertEqual. Fix calling os.path.exists. Change-Id: I745df5af4f6a1fadb73c54b8ee31abfbda335fc4 Closes-Bug: 1988668 Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
parent
b05b27c0b6
commit
3e6650f99e
@ -421,7 +421,8 @@ class TestExampleBroker(unittest.TestCase):
|
|||||||
self.assertEqual(info['created_at'], created_at)
|
self.assertEqual(info['created_at'], created_at)
|
||||||
self.assertEqual(info['put_timestamp'], recreate_timestamp)
|
self.assertEqual(info['put_timestamp'], recreate_timestamp)
|
||||||
self.assertEqual(info['delete_timestamp'], delete_timestamp)
|
self.assertEqual(info['delete_timestamp'], delete_timestamp)
|
||||||
self.assertTrue(info['status_changed_at'], status_changed_at)
|
self.assertEqual(Timestamp(status_changed_at).normal,
|
||||||
|
info['status_changed_at'])
|
||||||
|
|
||||||
def test_merge_timestamps_recreate_with_objects(self):
|
def test_merge_timestamps_recreate_with_objects(self):
|
||||||
put_timestamp = next(self.ts).internal
|
put_timestamp = next(self.ts).internal
|
||||||
|
@ -1023,7 +1023,7 @@ class TestServer(unittest.TestCase):
|
|||||||
running_pids = server.get_running_pids()
|
running_pids = server.get_running_pids()
|
||||||
for f in ('thing-sayer.pid', 'other-doer.pid', 'other-sayer.pid'):
|
for f in ('thing-sayer.pid', 'other-doer.pid', 'other-sayer.pid'):
|
||||||
# other server pid files persist
|
# other server pid files persist
|
||||||
self.assertTrue(os.path.exists, os.path.join(t, f))
|
self.assertTrue(os.path.exists(os.path.join(t, f)))
|
||||||
# verify that servers are in fact not running
|
# verify that servers are in fact not running
|
||||||
for server_name in ('thing-sayer', 'other-doer', 'other-sayer'):
|
for server_name in ('thing-sayer', 'other-doer', 'other-sayer'):
|
||||||
server = manager.Server(server_name, run_dir=t)
|
server = manager.Server(server_name, run_dir=t)
|
||||||
@ -1644,9 +1644,9 @@ class TestServer(unittest.TestCase):
|
|||||||
pids = server.stop(number=3)
|
pids = server.stop(number=3)
|
||||||
self.assertEqual(len(pids), 1)
|
self.assertEqual(len(pids), 1)
|
||||||
expected = {
|
expected = {
|
||||||
3: conf3,
|
3: self.join_run_dir('account-reaper/3.pid'),
|
||||||
}
|
}
|
||||||
self.assertTrue(pids, expected)
|
self.assertEqual(expected, pids)
|
||||||
self.assertEqual(manager.os.pid_sigs[3], [signal.SIGTERM])
|
self.assertEqual(manager.os.pid_sigs[3], [signal.SIGTERM])
|
||||||
self.assertFalse(os.path.exists(conf4))
|
self.assertFalse(os.path.exists(conf4))
|
||||||
self.assertFalse(os.path.exists(conf3))
|
self.assertFalse(os.path.exists(conf3))
|
||||||
|
@ -756,7 +756,7 @@ class TestStoragePolicies(unittest.TestCase):
|
|||||||
|
|
||||||
policies = parse_storage_policies(orig_conf)
|
policies = parse_storage_policies(orig_conf)
|
||||||
self.assertEqual(policies.default, policies[1])
|
self.assertEqual(policies.default, policies[1])
|
||||||
self.assertTrue(policies[0].name, 'Policy-0')
|
self.assertEqual('zero', policies[0].name)
|
||||||
|
|
||||||
bad_conf = self._conf("""
|
bad_conf = self._conf("""
|
||||||
[storage-policy:0]
|
[storage-policy:0]
|
||||||
|
Loading…
Reference in New Issue
Block a user