def test_bw_usage_get(self): self.mox.StubOutWithMock(db, "bw_usage_update") self.mox.StubOutWithMock(db, "bw_usage_get") get_args = (self.context, "uuid", 0, "mac") db.bw_usage_get(*get_args).AndReturn("foo") self.mox.ReplayAll() result = self.conductor.bw_usage_get(*get_args) self.assertEqual(result, "foo")
def test_bw_usage_get(self): self.mox.StubOutWithMock(db, 'bw_usage_update') self.mox.StubOutWithMock(db, 'bw_usage_get') get_args = (self.context, 'uuid', 0, 'mac') db.bw_usage_get(*get_args).AndReturn('foo') self.mox.ReplayAll() result = self.conductor.bw_usage_get(*get_args) self.assertEqual(result, 'foo')
def get_by_instance_uuid_and_mac(cls, context, instance_uuid, mac, start_period=None, use_slave=False): db_bw_usage = db.bw_usage_get(context, uuid=instance_uuid, start_period=start_period, mac=mac, use_slave=use_slave) if db_bw_usage: return cls._from_db_object(context, cls(), db_bw_usage)
def _db_bw_usage_get(context, uuid, start_period, mac, use_slave=False): return db.bw_usage_get(context, uuid=uuid, start_period=start_period, mac=mac)