Merge "Fix incorrect usage of assertTrue"

This commit is contained in:
Zuul 2018-02-27 18:31:10 +00:00 committed by Gerrit Code Review
commit 85cccf7891
5 changed files with 18 additions and 18 deletions

View File

@ -217,8 +217,8 @@ class AddVolumeFailure(VolumeTest):
snapshot_id=None, name=name,
description=desc)
self.assertEqual(HUGE_VOLUME, volume["size"])
self.assertTrue("creating", volume["status"])
self.assertTrue("detached", volume["attach_status"])
self.assertEqual("creating", volume["status"])
self.assertEqual("detached", volume["attach_status"])
self.storyFail.volume = volume
self.storyFail.volume_id = volume["id"]
@ -236,8 +236,8 @@ class AfterVolumeFailureIsAdded(VolumeTest):
"""Wait until the volume is a FAILURE."""
volume = poll_until(lambda: self.storyFail.get_volume(),
lambda volume: volume["status"] != "creating")
self.assertEqual(volume["status"], "error")
self.assertTrue(volume["attach_status"], "detached")
self.assertEqual("error", volume["status"])
self.assertEqual("detached", volume["attach_status"])
@time_out(60)
def test_mgmt_volume_check(self):
@ -267,8 +267,8 @@ class AddVolume(VolumeTest):
snapshot_id=None, name=name,
description=desc)
self.assert_volume_as_expected(volume)
self.assertTrue("creating", volume["status"])
self.assertTrue("detached", volume["attach_status"])
self.assertEqual("creating", volume["status"])
self.assertEqual("detached", volume["attach_status"])
self.story.volume = volume
self.story.volume_id = volume["id"]
@ -286,9 +286,9 @@ class AfterVolumeIsAdded(VolumeTest):
"""Wait until the volume is finished provisioning."""
volume = poll_until(lambda: self.story.get_volume(),
lambda volume: volume["status"] != "creating")
self.assertEqual(volume["status"], "available")
self.assertEqual("available", volume["status"])
self.assert_volume_as_expected(volume)
self.assertTrue(volume["attach_status"], "detached")
self.assertEqual("detached", volume["attach_status"])
@time_out(60)
def test_mgmt_volume_check(self):
@ -404,9 +404,9 @@ class ResizeVolume(VolumeTest):
volume = poll_until(lambda: self.story.get_volume(),
lambda volume: volume["status"] == "resized")
self.assertEqual(volume["status"], "resized")
self.assertTrue(volume["attach_status"], "attached")
self.assertTrue(volume['size'], self.story.resize_volume_size)
self.assertEqual("resized", volume["status"])
self.assertEqual("attached", volume["attach_status"])
self.assertEqual(self.story.resize_volume_size, volume['size'])
@time_out(300)
def test_resizefs_rescan(self):

View File

@ -60,7 +60,7 @@ class TestClusterController(trove_testtools.TestCase):
schema = self.controller.get_schema('create', self.cluster)
self.assertIsNotNone(schema)
self.assertIn('cluster', schema['properties'])
self.assertTrue('cluster')
self.assertIsNotNone(schema['properties']['cluster'])
def test_validate_create(self):
body = self.cluster

View File

@ -74,7 +74,7 @@ class TestClusterController(trove_testtools.TestCase):
schema = self.controller.get_schema('create', self.cluster)
self.assertIsNotNone(schema)
self.assertIn('cluster', schema['properties'])
self.assertTrue('cluster')
self.assertIsNotNone(schema['properties']['cluster'])
def test_validate_create(self):
body = self.cluster

View File

@ -60,7 +60,7 @@ class TestClusterController(trove_testtools.TestCase):
schema = self.controller.get_schema('create', self.cluster)
self.assertIsNotNone(schema)
self.assertIn('cluster', schema['properties'])
self.assertTrue('cluster')
self.assertIsNotNone(schema['properties']['cluster'])
def test_validate_create(self):
body = self.cluster

View File

@ -111,7 +111,7 @@ class TestRootController(trove_testtools.TestCase):
root_controller.root_index = Mock(return_value=ret)
service_load_root_controller.return_value = root_controller
self.assertTrue(ret, self.controller.index(req, tenant_id, uuid))
self.assertEqual(ret, self.controller.index(req, tenant_id, uuid))
service_get_datastore.assert_called_with(tenant_id, uuid)
service_load_root_controller.assert_called_with(ds_manager)
root_controller.root_index.assert_called_with(
@ -135,7 +135,7 @@ class TestRootController(trove_testtools.TestCase):
root_controller.root_create = Mock(return_value=ret)
service_load_root_controller.return_value = root_controller
self.assertTrue(
self.assertEqual(
ret, self.controller.create(req, tenant_id, uuid, body=body))
service_get_datastore.assert_called_with(tenant_id, uuid)
service_load_root_controller.assert_called_with(ds_manager)
@ -280,8 +280,8 @@ class TestClusterRootController(trove_testtools.TestCase):
cluster_instances = [db_inst_1, db_inst_2]
mock_find_all.return_value.all.return_value = cluster_instances
ret = self.controller._get_cluster_instance_id(tenant_id, cluster_id)
self.assertTrue(db_inst_1.id, ret[0])
self.assertTrue(cluster_instances, ret[1])
self.assertEqual(db_inst_1.id, ret[0])
self.assertEqual([db_inst_1.id, db_inst_2.id], ret[1])
@patch.object(models.ClusterRoot, "create")
def test_instance_root_create(self, mock_cluster_root_create):