Exemplo n.º 1
0
 def _compare(test, db, obj):
     for field, value in db.items():
         # NOTE(danms): The datetimes on SQLA models are tz-unaware,
         # but the object has tz-aware datetimes. If we're comparing
         # a model to an object (as opposed to a fake dict), just
         # ignore the datetimes in the comparison.
         if (isinstance(db, api_models.API_BASE) and
               isinstance(value, datetime.datetime)):
             continue
         test.assertEqual(db[field], obj[field])
Exemplo n.º 2
0
 def _compare(test, db, obj):
     for field, value in db.items():
         # NOTE(danms): The datetimes on SQLA models are tz-unaware,
         # but the object has tz-aware datetimes. If we're comparing
         # a model to an object (as opposed to a fake dict), just
         # ignore the datetimes in the comparison.
         if (isinstance(db, api_models.API_BASE)
                 and isinstance(value, datetime.datetime)):
             continue
         test.assertEqual(db[field], obj[field])
Exemplo n.º 3
0
 def _compare(test, db, obj, ignored_fields=None):
     if ignored_fields is None:
         ignored_fields = []
     for field, value in db.items():
         if field in ignored_fields:
             continue
         obj_field = field
         if obj_field == 'uuid':
             obj_field = 'instance_uuid'
         test.assertEqual(db[field], obj[obj_field],
                          'Field %s is not equal' % field)
Exemplo n.º 4
0
 def _compare(test, db, obj, ignored_fields=None):
     if ignored_fields is None:
         ignored_fields = []
     for field, value in db.items():
         if field in ignored_fields:
             continue
         obj_field = field
         if obj_field == 'uuid':
             obj_field = 'instance_uuid'
         test.assertEqual(db[field], obj[obj_field],
                 'Field {0!s} is not equal'.format(field))
Exemplo n.º 5
0
 def _compare(test, db, obj, ignored_fields=None):
     if ignored_fields is None:
         ignored_fields = []
     for field, value in db.items():
         if field in ignored_fields:
             continue
         obj_field = field
         if obj_field == 'uuid':
             obj_field = 'instance_uuid'
         test.assertEqual(db[field], getattr(obj, obj_field),
                 'Field %s is not equal' % field)
Exemplo n.º 6
0
 def _compare(test, db, obj):
     for field, value in db.items():
         test.assertEqual(db[field], obj[field])
Exemplo n.º 7
0
 def _compare(test, db, obj):
     for field, value in db.items():
         test.assertEqual(db[field], obj[field])
 def _compare(test, db, obj):
     for field, value in db.items():
         test.assertEqual(db[field], getattr(obj, field))
 def _compare(test, db, obj):
     for field, value in db.items():
         obj_field = field
         if obj_field == 'uuid':
             obj_field = 'instance_uuid'
         test.assertEqual(db[field], obj[obj_field])
Exemplo n.º 10
0
 def _compare(test, db, obj):
     for field, value in db.items():
         test.assertEqual(db[field], getattr(obj, field))
Exemplo n.º 11
0
 def _compare(test, db, obj):
     for field, value in db.items():
         obj_field = field
         if obj_field == "uuid":
             obj_field = "instance_uuid"
         test.assertEqual(db[field], obj[obj_field])