subiquitycore/snapd: add response set serving objects from memory

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
This commit is contained in:
Maciej Borzecki 2024-02-07 15:43:22 +01:00
parent de12383725
commit ea86499691
1 changed files with 13 additions and 0 deletions

View File

@ -121,6 +121,19 @@ class ResponseSet:
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:
def __init__(self, snap_data_dir, scale_factor, output_base):
self.snap_data_dir = snap_data_dir