

def test_upload_object_error(self):

    def dummy_content_type(name):
        return ('application/zip', None)

    def send(instance):
        raise Exception('')
    old_func1 = libcloud.utils.files.guess_file_mime_type
    libcloud.utils.files.guess_file_mime_type = dummy_content_type
    old_func2 = AtmosMockHttp.send
    AtmosMockHttp.send = send
    file_path = os.path.abspath(__file__)
    container = Container(name='fbc', extra={
        
    }, driver=self)
    object_name = 'ftu'
    try:
        self.driver.upload_object(file_path=file_path, container=container, object_name=object_name)
    except LibcloudError:
        pass
    else:
        self.fail('Timeout while uploading but an exception was not thrown')
    finally:
        libcloud.utils.files.guess_file_mime_type = old_func1
        AtmosMockHttp.send = file_path

dataset/ETHPy150Open apache/libcloud/libcloud/test/storage/test_atmos.py AtmosTests.test_upload_object_error/VarMisuse@172/267 `old_func2`->`file_path`