def test_get_by_id(self): self.mox.StubOutWithMock(db, 'compute_node_get') db.compute_node_get(self.context, 123).AndReturn(fake_compute_node) self.mox.ReplayAll() compute = compute_node.ComputeNode.get_by_id(self.context, 123) self.compare_obj(compute, fake_compute_node, subs=self.subs(), comparators=self.comparators())
def get_by_id(cls, context, compute_id): db_compute = db.compute_node_get(context, compute_id) return cls._from_db_object(context, cls(), db_compute)