<reponame>rsdoherty/azure-sdk-for-python<filename>sdk/storage/azure-storage-blob/tests/perfstress_tests/T1_legacy_tests/upload_block.py<gh_stars>1000+
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import uuid

from azure_devtools.perfstress_tests import get_random_bytes

from ._test_base_legacy import _LegacyContainerTest


class LegacyUploadBlockTest(_LegacyContainerTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.blob_name = "blobblocktest-" + str(uuid.uuid4())
        self.block_id = str(uuid.uuid4())
        self.data = get_random_bytes(self.args.size)

    def run_sync(self):
        self.service_client.put_block(
            container_name=self.container_name,
            blob_name=self.blob_name,
            block=self.data,
            block_id=self.block_id)

    async def run_async(self):
        raise NotImplementedError("Async not supported for legacy T1 tests.")

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import uuid

from azure_devtools.perfstress_tests import get_random_bytes

from ._test_base_legacy import _LegacyContainerTest


class LegacyUploadBlockTest(_LegacyContainerTest):
    def __init__(self, arguments):
        super().__init__(arguments)
        self.blob_name = "blobblocktest-" + str(uuid.uuid4())
        self.block_id = str(uuid.uuid4())
        self.data = get_random_bytes(self.args.size)

    def run_sync(self):
        self.service_client.put_block(
            container_name=self.container_name,
            blob_name=self.blob_name,
            block=self.data,
            block_id=self.block_id)

    async def run_async(self):
        raise NotImplementedError("Async not supported for legacy T1 tests.")
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------------------------------