initialize objects with context in FixedIP 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: I60be29ba0c6ccbadd4c4d9a2d5426d1047c01a82
This commit is contained in:
melanie witt
2014-12-17 00:13:17 +00:00
parent 0419987801
commit 814bb16dfe

View File

@@ -200,8 +200,8 @@ class _TestFixedIPObject(object):
@mock.patch('nova.db.fixed_ip_create')
def test_create(self, create):
create.return_value = fake_fixed_ip
fixedip = fixed_ip.FixedIP(address='1.2.3.4')
fixedip.create(self.context)
fixedip = fixed_ip.FixedIP(context=self.context, address='1.2.3.4')
fixedip.create()
create.assert_called_once_with(
self.context, {'address': '1.2.3.4'})
self._compare(fixedip, fake_fixed_ip)