def test_save(self): self.mox.StubOutWithMock(db, 'service_update') db.service_update(self.context, 123, {'host': 'fake-host'}).AndReturn( fake_service) self.mox.ReplayAll() service_obj = service.Service(context=self.context) service_obj.id = 123 service_obj.host = 'fake-host' service_obj.save()
def save(self): updates = self.obj_get_changes() updates.pop('id', None) db_service = db.service_update(self._context, self.id, updates) self._from_db_object(self._context, self, db_service)