Exemplo n.º 1
0
 def test_azfs_path(self):
     self.assertEqual(
         blobstorageio.parse_azfs_path(
             'azfs://storageaccount/container/name'),
         ('storageaccount', 'container', 'name'))
     self.assertEqual(
         blobstorageio.parse_azfs_path(
             'azfs://storageaccount/container/name/sub'),
         ('storageaccount', 'container', 'name/sub'))
Exemplo n.º 2
0
 def test_azfs_path_blob_optional(self):
     self.assertEqual(
         blobstorageio.parse_azfs_path(
             'azfs://storageaccount/container/name', blob_optional=True),
         ('storageaccount', 'container', 'name'))
     self.assertEqual(
         blobstorageio.parse_azfs_path('azfs://storageaccount/container/',
                                       blob_optional=True),
         ('storageaccount', 'container', ''))
Exemplo n.º 3
0
    def _insert_random_file(self, path, size):
        storage_account, container, blob = blobstorageio.parse_azfs_path(path)
        contents = os.urandom(size)
        fake_file = FakeFile(container, blob, contents)

        f = self.azfs.open(path, 'w')
        f.write(contents)
        f.close()

        return fake_file
Exemplo n.º 4
0
    def __init__(self, client, path, mime_type='application/octet-stream'):
        self._client = client
        self._path = path
        self._container, self._blob = parse_azfs_path(path)
        self._content_settings = ContentSettings(mime_type)

        self._blob_to_upload = self._client.get_blob_client(
            self._container, self._blob)

        self.block_number = 1
        self.buffer = BytesBuffer()
        self.block_list = []