subiquitycore/snapd: add response set serving objects from memory
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
This commit is contained in:
parent
de12383725
commit
ea86499691
|
@ -121,6 +121,19 @@ class ResponseSet:
|
||||||
return _FakeFileResponse(f)
|
return _FakeFileResponse(f)
|
||||||
|
|
||||||
|
|
||||||
|
class MemoryResponseSet:
|
||||||
|
"""Set of response for an endpoint which returns data stored in memory."""
|
||||||
|
|
||||||
|
def __init__(self, data):
|
||||||
|
self.data = data
|
||||||
|
self.index = 0
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
d = self.data[self.index]
|
||||||
|
self.index += 1
|
||||||
|
return _FakeMemoryResponse(d)
|
||||||
|
|
||||||
|
|
||||||
class FakeSnapdConnection:
|
class FakeSnapdConnection:
|
||||||
def __init__(self, snap_data_dir, scale_factor, output_base):
|
def __init__(self, snap_data_dir, scale_factor, output_base):
|
||||||
self.snap_data_dir = snap_data_dir
|
self.snap_data_dir = snap_data_dir
|
||||||
|
|
Loading…
Reference in New Issue