Merge branch 'staging' into azure-subscriptions

This commit is contained in:
tomdds
2020-01-31 15:43:08 -05:00
committed by GitHub
11 changed files with 243 additions and 135 deletions

View File

@@ -0,0 +1,22 @@
from atst.domain.csp.files import AzureFileService
from azure.storage.blob.models import Blob
class MockBlockBlobService(object):
def __init__(self, exception=None, **kwargs):
self.exception = exception
def get_blob_to_bytes(self, blob_name="test.pdf", **kwargs):
if self.exception:
raise self.exception
else:
return Blob(name=blob_name, content=b"mock content")
def test_download_task_order_success(app, monkeypatch):
file_service = AzureFileService(config=app.config)
file_service.BlockBlobService = MockBlockBlobService
task_order = file_service.download_task_order("test.pdf")
assert task_order["name"] == "test.pdf"
assert task_order["content"] == b"mock content"