Exemple #1
0
 def test_aggregate_get(self):
     """Ensure we can get aggregate with all its relations."""
     ctxt = context.get_admin_context()
     result = _create_aggregate_with_hosts(context=ctxt)
     expected = db.aggregate_get(ctxt, result.id)
     self.assertEqual(_get_fake_aggr_hosts(), expected.hosts)
     self.assertEqual(_get_fake_aggr_metadata(), expected.metadetails)
Exemple #2
0
 def test_aggregate_delete(self):
     """Ensure we can delete an aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate(context=ctxt, metadata=None)
     db.aggregate_delete(ctxt, result['id'])
     expected = db.aggregate_get_all(ctxt)
     self.assertEqual(0, len(expected))
     aggregate = db.aggregate_get(ctxt.elevated(read_deleted='yes'),
                                  result['id'])
     self.assertEqual(aggregate["operational_state"], "dismissed")
Exemple #3
0
 def wrapper(context, aggregate_id, *args, **kwargs):
     db.aggregate_get(context, aggregate_id)
     return f(context, aggregate_id, *args, **kwargs)