def test_save(self): self.mox.StubOutWithMock(db, 'security_group_update') updated_secgroup = dict(fake_secgroup, project_id='changed') db.security_group_update(self.context, 1, { 'description': 'foobar' }).AndReturn(updated_secgroup) self.mox.ReplayAll() secgroup = security_group.SecurityGroup._from_db_object( self.context, security_group.SecurityGroup(), fake_secgroup) secgroup.description = 'foobar' secgroup.save() self.assertEqual(self._fix_deleted(updated_secgroup), dict(secgroup.items())) self.assertEqual(secgroup.obj_what_changed(), set()) self.assertRemotes()
def save(self): updates = self.obj_get_changes() if updates: db_secgroup = db.security_group_update(self._context, self.id, updates) self._from_db_object(self._context, self, db_secgroup) self.obj_reset_changes()
def test_save(self): self.mox.StubOutWithMock(db, 'security_group_update') updated_secgroup = dict(fake_secgroup, project_id='changed') db.security_group_update(self.context, 1, {'description': 'foobar'}).AndReturn( updated_secgroup) self.mox.ReplayAll() secgroup = security_group.SecurityGroup._from_db_object( self.context, security_group.SecurityGroup(), fake_secgroup) secgroup.description = 'foobar' secgroup.save() self.assertEqual(self._fix_deleted(updated_secgroup), dict(secgroup.items())) self.assertEqual(secgroup.obj_what_changed(), set()) self.assertRemotes()