initialize objects with context in InstanceFault object tests
These changes aim to clean up the pattern of passing a context in object member functions create/destroy/refresh/save and instead initialize the object with the context when it's constructed. Related to blueprint kilo-objects Change-Id: Ia6be84d85e1e2a394a88c8f16d92af8dc90d7c4e
This commit is contained in:
@@ -77,13 +77,13 @@ class _TestInstanceFault(object):
|
|||||||
@mock.patch('nova.db.instance_fault_create')
|
@mock.patch('nova.db.instance_fault_create')
|
||||||
def _test_create(self, update_cells, mock_create, cells_fault_create):
|
def _test_create(self, update_cells, mock_create, cells_fault_create):
|
||||||
mock_create.return_value = fake_faults['fake-uuid'][1]
|
mock_create.return_value = fake_faults['fake-uuid'][1]
|
||||||
fault = instance_fault.InstanceFault()
|
fault = instance_fault.InstanceFault(context=self.context)
|
||||||
fault.instance_uuid = 'fake-uuid'
|
fault.instance_uuid = 'fake-uuid'
|
||||||
fault.code = 456
|
fault.code = 456
|
||||||
fault.message = 'foo'
|
fault.message = 'foo'
|
||||||
fault.details = 'you screwed up'
|
fault.details = 'you screwed up'
|
||||||
fault.host = 'myhost'
|
fault.host = 'myhost'
|
||||||
fault.create(self.context)
|
fault.create()
|
||||||
self.assertEqual(2, fault.id)
|
self.assertEqual(2, fault.id)
|
||||||
mock_create.assert_called_once_with(self.context,
|
mock_create.assert_called_once_with(self.context,
|
||||||
{'instance_uuid': 'fake-uuid',
|
{'instance_uuid': 'fake-uuid',
|
||||||
|
|||||||
Reference in New Issue
Block a user