Merge "initialize objects with context in Aggregate object tests"
This commit is contained in:
commit
84bb8ecfd6
@ -50,10 +50,10 @@ class _TestAggregateObject(object):
|
|||||||
db.aggregate_create(self.context, {'name': 'foo'},
|
db.aggregate_create(self.context, {'name': 'foo'},
|
||||||
metadata={'one': 'two'}).AndReturn(fake_aggregate)
|
metadata={'one': 'two'}).AndReturn(fake_aggregate)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
agg = aggregate.Aggregate()
|
agg = aggregate.Aggregate(context=self.context)
|
||||||
agg.name = 'foo'
|
agg.name = 'foo'
|
||||||
agg.metadata = {'one': 'two'}
|
agg.metadata = {'one': 'two'}
|
||||||
agg.create(self.context)
|
agg.create()
|
||||||
self.compare_obj(agg, fake_aggregate, subs=SUBS)
|
self.compare_obj(agg, fake_aggregate, subs=SUBS)
|
||||||
|
|
||||||
def test_recreate_fails(self):
|
def test_recreate_fails(self):
|
||||||
@ -61,10 +61,10 @@ class _TestAggregateObject(object):
|
|||||||
db.aggregate_create(self.context, {'name': 'foo'},
|
db.aggregate_create(self.context, {'name': 'foo'},
|
||||||
metadata={'one': 'two'}).AndReturn(fake_aggregate)
|
metadata={'one': 'two'}).AndReturn(fake_aggregate)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
agg = aggregate.Aggregate()
|
agg = aggregate.Aggregate(context=self.context)
|
||||||
agg.name = 'foo'
|
agg.name = 'foo'
|
||||||
agg.metadata = {'one': 'two'}
|
agg.metadata = {'one': 'two'}
|
||||||
agg.create(self.context)
|
agg.create()
|
||||||
self.assertRaises(exception.ObjectActionError, agg.create,
|
self.assertRaises(exception.ObjectActionError, agg.create,
|
||||||
self.context)
|
self.context)
|
||||||
|
|
||||||
@ -73,10 +73,10 @@ class _TestAggregateObject(object):
|
|||||||
db.aggregate_update(self.context, 123, {'name': 'baz'}).AndReturn(
|
db.aggregate_update(self.context, 123, {'name': 'baz'}).AndReturn(
|
||||||
fake_aggregate)
|
fake_aggregate)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
agg = aggregate.Aggregate()
|
agg = aggregate.Aggregate(context=self.context)
|
||||||
agg.id = 123
|
agg.id = 123
|
||||||
agg.name = 'baz'
|
agg.name = 'baz'
|
||||||
agg.save(self.context)
|
agg.save()
|
||||||
self.compare_obj(agg, fake_aggregate, subs=SUBS)
|
self.compare_obj(agg, fake_aggregate, subs=SUBS)
|
||||||
|
|
||||||
def test_save_and_create_no_hosts(self):
|
def test_save_and_create_no_hosts(self):
|
||||||
@ -116,9 +116,9 @@ class _TestAggregateObject(object):
|
|||||||
self.mox.StubOutWithMock(db, 'aggregate_delete')
|
self.mox.StubOutWithMock(db, 'aggregate_delete')
|
||||||
db.aggregate_delete(self.context, 123)
|
db.aggregate_delete(self.context, 123)
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
agg = aggregate.Aggregate()
|
agg = aggregate.Aggregate(context=self.context)
|
||||||
agg.id = 123
|
agg.id = 123
|
||||||
agg.destroy(self.context)
|
agg.destroy()
|
||||||
|
|
||||||
def test_add_host(self):
|
def test_add_host(self):
|
||||||
self.mox.StubOutWithMock(db, 'aggregate_host_add')
|
self.mox.StubOutWithMock(db, 'aggregate_host_add')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user