diff --git a/app/backend/requirements.in b/app/backend/requirements.in index 756a857192..9ccaae4634 100644 --- a/app/backend/requirements.in +++ b/app/backend/requirements.in @@ -8,7 +8,7 @@ azure-ai-documentintelligence==1.0.0b4 azure-cognitiveservices-speech azure-cosmos azure-search-documents==11.7.0b1 -azure-storage-blob +azure-storage-blob==12.27.0 azure-storage-file-datalake uvicorn aiohttp diff --git a/app/backend/requirements.txt b/app/backend/requirements.txt index 5eab109d1f..450dc60c56 100644 --- a/app/backend/requirements.txt +++ b/app/backend/requirements.txt @@ -58,7 +58,7 @@ azure-monitor-opentelemetry-exporter==1.0.0b44 # via azure-monitor-opentelemetry azure-search-documents==11.7.0b1 # via -r requirements.in -azure-storage-blob==12.22.0 +azure-storage-blob==12.27.0 # via # -r requirements.in # azure-storage-file-datalake diff --git a/tests/mocks.py b/tests/mocks.py index 6c52ee90e5..68cb665885 100644 --- a/tests/mocks.py +++ b/tests/mocks.py @@ -75,6 +75,29 @@ async def readinto(self, buffer: BytesIO): buffer.write(b"test") +class MockContentReader: + """Mock content reader for aiohttp.ClientResponse""" + def __init__(self, body_bytes): + self._body = body_bytes + self._offset = 0 + self._exception = None + + async def read(self, n=-1): + if n == -1: + result = self._body[self._offset:] + self._offset = len(self._body) + else: + result = self._body[self._offset:self._offset + n] + self._offset += len(result) + return result + + def exception(self): + return self._exception + + def set_exception(self, exc): + self._exception = exc + + class MockAiohttpClientResponse404(aiohttp.ClientResponse): def __init__(self, url, body_bytes, headers=None): self._body = body_bytes @@ -83,6 +106,8 @@ def __init__(self, url, body_bytes, headers=None): self.status = 404 self.reason = "Not Found" self._url = url + self._loop = None + self.content = MockContentReader(body_bytes) class MockAiohttpClientResponse(aiohttp.ClientResponse): @@ -93,6 +118,8 @@ def __init__(self, url, body_bytes, headers=None): self.status = 200 self.reason = "OK" self._url = url + self._loop = None + self.content = MockContentReader(body_bytes) class MockTransport(AsyncHttpTransport):