Use assertTrue/False instead of assertEqual(T/F)

The usage of assertEqual(True/False, ***) should be changed to a more
meaningful format of assertTrue/False(***).

Change-Id: I685f7bb0b4669d8813ebbb796b6014ad44d7ff0c
Closes-Bug: #1510001
changes/67/239467/2
Bertrand Lallau 7 years ago committed by Bertrand Lallau
parent 55f30cc976
commit f0ea022853
  1. 6
      contrib/rackspace/rackspace/tests/test_cloud_loadbalancer.py
  2. 4
      heat/tests/mistral/test_mistral_workflow.py
  3. 2
      heat/tests/neutron/test_neutron_metering.py
  4. 2
      heat/tests/neutron/test_neutron_network_gateway.py
  5. 2
      heat/tests/neutron/test_neutron_port.py
  6. 6
      heat/tests/test_convg_stack.py
  7. 4
      heat/tests/test_engine_service.py
  8. 4
      heat/tests/test_parameters.py
  9. 2
      heat/tests/test_properties.py
  10. 2
      heat/tests/test_stack_resource.py
  11. 2
      heat/tests/test_stack_update.py
  12. 8
      heat_integrationtests/functional/test_preview.py

@ -1555,7 +1555,7 @@ class LoadBalancerTest(common.HeatTestCase):
self.m.ReplayAll()
scheduler.TaskRunner(rsrc.update, update_template)()
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
self.assertEqual(True, fake_lb.connection_logging)
self.assertTrue(fake_lb.connection_logging)
self.m.VerifyAll()
def test_update_connection_logging_delete(self):
@ -1589,7 +1589,7 @@ class LoadBalancerTest(common.HeatTestCase):
scheduler.TaskRunner(rsrc.update, update_template)()
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
self.assertEqual(False, fake_lb.connection_logging)
self.assertFalse(fake_lb.connection_logging)
self.m.VerifyAll()
def test_update_connection_logging_disable(self):
@ -1613,7 +1613,7 @@ class LoadBalancerTest(common.HeatTestCase):
scheduler.TaskRunner(rsrc.update, update_template)()
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
self.assertEqual(False, fake_lb.connection_logging)
self.assertFalse(fake_lb.connection_logging)
self.m.VerifyAll()
def test_update_connection_throttle_add(self):

@ -629,11 +629,11 @@ class TestMistralWorkflow(common.HeatTestCase):
self.assertEqual(5, task['retry']['delay'])
self.assertEqual(15, task['retry']['count'])
self.assertEqual(8, task['wait-after'])
self.assertEqual(True, task['pause-before'])
self.assertTrue(task['pause-before'])
self.assertEqual(11, task['timeout'])
self.assertEqual('test', task['target'])
self.assertEqual(7, task['wait-before'])
self.assertEqual(False, task['keep-result'])
self.assertFalse(task['keep-result'])
return [FakeWorkflow('create_vm')]

@ -154,7 +154,7 @@ class MeteringLabelTest(common.HeatTestCase):
self.assertEqual('TestLabel', rsrc.FnGetAtt('name'))
self.assertEqual('Description of TestLabel',
rsrc.FnGetAtt('description'))
self.assertEqual(True, rsrc.FnGetAtt('shared'))
self.assertTrue(rsrc.FnGetAtt('shared'))
self.m.VerifyAll()

@ -568,7 +568,7 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
scheduler.TaskRunner(rsrc.create)()
self.assertEqual(u'ed4c03b9-8251-4c09-acc4-e59ee9e6aa37',
rsrc.FnGetRefId())
self.assertEqual(False, rsrc.FnGetAtt('default'))
self.assertFalse(rsrc.FnGetAtt('default'))
error = self.assertRaises(exception.InvalidTemplateAttribute,
rsrc.FnGetAtt, 'hoge')

@ -559,7 +559,7 @@ class NeutronPortTest(common.HeatTestCase):
scheduler.TaskRunner(port.create)()
self.assertEqual('DOWN', port.FnGetAtt('status'))
self.assertEqual([], port.FnGetAtt('allowed_address_pairs'))
self.assertEqual(True, port.FnGetAtt('admin_state_up'))
self.assertTrue(port.FnGetAtt('admin_state_up'))
self.assertEqual('net1234', port.FnGetAtt('network_id'))
self.assertEqual('fa:16:3e:75:67:60', port.FnGetAtt('mac_address'))
self.assertEqual(utils.PhysName('test_stack', 'port'),

@ -62,7 +62,7 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
self.assertIsNone(stack_db.prev_raw_template_id)
self.assertEqual(stack_db.convergence, True)
self.assertTrue(stack_db.convergence)
self.assertEqual({'edges': [[[1, True], None]]}, stack_db.current_deps)
leaves = stack.convergence_dependencies.leaves()
expected_calls = []
@ -92,7 +92,7 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
self.assertIsNotNone(stack_db.current_traversal)
self.assertIsNotNone(stack_db.raw_template_id)
self.assertIsNone(stack_db.prev_raw_template_id)
self.assertEqual(stack_db.convergence, True)
self.assertTrue(stack_db.convergence)
self.assertEqual(sorted([[[3, True], [5, True]], # C, A
[[3, True], [4, True]], # C, B
[[1, True], [3, True]], # E, C
@ -195,7 +195,7 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
self.assertIsNotNone(stack_db.raw_template_id)
self.assertIsNotNone(stack_db.current_traversal)
self.assertIsNotNone(stack_db.prev_raw_template_id)
self.assertEqual(True, stack_db.convergence)
self.assertTrue(stack_db.convergence)
self.assertEqual(sorted([[[7, True], [8, True]],
[[8, True], [5, True]],
[[8, True], [4, True]],

@ -254,7 +254,7 @@ class StackConvergenceServiceCreateUpdateTest(common.HeatTestCase):
result = self.man.create_stack(self.ctx, 'service_create_test_stack',
template, params, None, api_args)
db_stack = stack_object.Stack.get_by_id(self.ctx, result['stack_id'])
self.assertEqual(db_stack.convergence, True)
self.assertTrue(db_stack.convergence)
self.assertEqual(result['stack_id'], db_stack.id)
self.m.VerifyAll()
@ -307,7 +307,7 @@ class StackConvergenceServiceCreateUpdateTest(common.HeatTestCase):
api_args = {'timeout_mins': 60, 'disable_rollback': False}
result = self.man.update_stack(self.ctx, old_stack.identifier(),
template, params, None, api_args)
self.assertEqual(old_stack.convergence, True)
self.assertTrue(old_stack.convergence)
self.assertEqual(old_stack.identifier(), result)
self.assertIsInstance(result, dict)
self.assertTrue(result['stack_id'])

@ -400,13 +400,13 @@ class ParameterTestSpecific(common.HeatTestCase):
schema = {'Type': 'Boolean'}
for val in ('1', 't', 'true', 'on', 'y', 'yes', True, 1):
bo = new_parameter('bo', schema, val)
self.assertEqual(True, bo.value())
self.assertTrue(bo.value())
def test_bool_value_false(self):
schema = {'Type': 'Boolean'}
for val in ('0', 'f', 'false', 'off', 'n', 'no', False, 0):
bo = new_parameter('bo', schema, val)
self.assertEqual(False, bo.value())
self.assertFalse(bo.value())
def test_bool_value_invalid(self):
schema = {'Type': 'Boolean'}

@ -1027,7 +1027,7 @@ class PropertiesTest(common.HeatTestCase):
self.assertEqual('foofoo', self.props['string'])
def test_bool_not_str(self):
self.assertEqual(False, self.props['default_bool'])
self.assertFalse(self.props['default_bool'])
def test_missing_required(self):
self.assertRaises(ValueError, self.props.get, 'required_int')

@ -535,7 +535,7 @@ class StackResourceTest(StackResourceBaseTest):
self.parent_resource.properties,
self.parent_resource)
self.assertEqual(True, need_update)
self.assertTrue(need_update)
def test_need_update_in_failed_state_for_nested_resource(self):
"""Test the resource with no nested stack should need replacement.

@ -189,7 +189,7 @@ class StackUpdateTest(common.HeatTestCase):
self.stack.update(updated_stack)
self.assertEqual((stack.Stack.UPDATE, stack.Stack.COMPLETE),
self.stack.state)
self.assertEqual(True, self.stack.disable_rollback)
self.assertTrue(self.stack.disable_rollback)
def test_update_tags(self):
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',

@ -103,9 +103,9 @@ parameters:
res['resource_type'])
# common properties
self.assertEqual(False, res['properties']['fail'])
self.assertFalse(res['properties']['fail'])
self.assertEqual(0, res['properties']['wait_secs'])
self.assertEqual(False, res['properties']['update_replace'])
self.assertFalse(res['properties']['update_replace'])
if res['resource_name'] == 'one':
self.assertEqual('fred', res['properties']['value'])
@ -180,9 +180,9 @@ outputs:
self.assertEqual('OS::Heat::TestResource',
res['resource_type'])
self.assertEqual(False, res['properties']['fail'])
self.assertFalse(res['properties']['fail'])
self.assertEqual(0, res['properties']['wait_secs'])
self.assertEqual(False, res['properties']['update_replace'])
self.assertFalse(res['properties']['update_replace'])
self.assertEqual('abc', res['properties']['value'])
self.assertEqual([], res['required_by'])

Loading…
Cancel
Save