# Make sure we have all the extensions, extras extensions being OK.
exts = root.findall('{0}extension'.format(NS))
- self.assert_(len(exts) >= len(self.ext_list))
+ self.assertTrue(len(exts) >= len(self.ext_list))
# Make sure that at least Fox in Sox is correct.
(fox_ext, ) = [x for x in exts if x.get('alias') == 'FOXNSOX']
helpful_msg = (_("The following migrations are missing a downgrade:"
"\n\t%s") % '\n\t'.join(sorted(missing_downgrade)))
- self.assert_(not missing_downgrade, helpful_msg)
+ self.assertFalse(missing_downgrade, msg=helpful_msg)
ctx = context.RequestContext('fake', 'fake', roles=['johnny-admin'])
self.assertFalse(ctx.is_admin)
ctx = context.RequestContext('fake', 'fake', roles=['admin'])
- self.assert_(ctx.is_admin)
+ self.assertTrue(ctx.is_admin)
def test_custom_admin_role_is_admin(self):
# define explict rules for context_is_admin
brain = common_policy.Brain(rules, CONF.policy_default_rule)
common_policy.set_brain(brain)
ctx = context.RequestContext('fake', 'fake', roles=['johnny-admin'])
- self.assert_(ctx.is_admin)
+ self.assertTrue(ctx.is_admin)
ctx = context.RequestContext('fake', 'fake', roles=['administrator'])
- self.assert_(ctx.is_admin)
+ self.assertTrue(ctx.is_admin)
# default rule no longer applies
ctx = context.RequestContext('fake', 'fake', roles=['admin'])
self.assertFalse(ctx.is_admin)
ctx = context.RequestContext('fake', 'fake')
self.assertFalse(ctx.is_admin)
ctx = context.RequestContext('fake', 'fake', roles=['admin'])
- self.assert_(ctx.is_admin)
+ self.assertTrue(ctx.is_admin)
app.stop()
ref = db.service_get(context.get_admin_context(), app.service_id)
db.service_destroy(context.get_admin_context(), app.service_id)
- self.assert_(not ref['disabled'])
+ self.assertFalse(ref['disabled'])
def test_service_disabled_on_create_based_on_flag(self):
self.flags(enable_new_services=False)
app.stop()
ref = db.service_get(context.get_admin_context(), app.service_id)
db.service_destroy(context.get_admin_context(), app.service_id)
- self.assert_(ref['disabled'])
+ self.assertTrue(ref['disabled'])
class ServiceTestCase(test.TestCase):
# the looping calls are created in StartService.
app = service.Service.create(host=host, binary=binary, topic=topic)
- self.assert_(app)
+ self.assertTrue(app)
def test_report_state_newly_disconnected(self):
host = 'foo'
'cinder.tests.test_service.FakeManager')
serv.start()
serv.report_state()
- self.assert_(serv.model_disconnected)
+ self.assertTrue(serv.model_disconnected)
def test_report_state_newly_connected(self):
host = 'foo'
serv.model_disconnected = True
serv.report_state()
- self.assert_(not serv.model_disconnected)
+ self.assertFalse(serv.model_disconnected)
class TestWSGIService(test.TestCase):