def test_openapi_azure_storage_get(self): banner('Get the blobs') result = run( "curl http://localhost:8080/cloudmesh/get_blob?service=azureblob'&'source=%7e%2fsample'&'destination=%2ftest%2fmp1%2ejpg'&'recursive=True" ) print(result) print()
def test_openapi_azure_storage_put(self): banner('Upload blobs') result = run( 'curl -H "Content-Type:application/json" -X POST -d \'{"service": "azureblob", "source": "~/sample/mp1.jpg", "destination": "/test", "recursive": "False"}\' http://localhost:8080/cloudmesh/put_blob' ) print(result) print()
def test_openapi_azure_storage_search(self): banner('search the blobs') result = run( "curl http://localhost:8080/cloudmesh/search_blob?service=azureblob'&'directory=%2ftest'&'filename=mp1%2ejpg'&'recursive=True" ) print(result) print()
def test_openapi_azure_storage_delete(self): banner('delete the blobs') result = run( "curl http://localhost:8080/cloudmesh/delete_blob?service=azureblob'&'source=%2ftest%2fmp1%2ejpg'&'recursive=False" ) print(result) print()
def test_delete(self): HEADING() # Deleting in google drive home sample_source.txt # message = self.p.delete(filname='sample_source.txt') filname = 'sample_source.txt' message = run(f"cms delete {filname}") assert message is not None
def test_setup(): self.variables = Variables() self.storage = Parameter.expand(variables['storage']) self.storage = storage[0] self.p = Provider(service=storage) self.openapi = run(command).execute() time.sleep(5)
def test_openapi_azure_storage_createdir(self): banner('Create a Directory') result = run( "curl http://localhost:8080/cloudmesh/create_dir?service=azureblob'&'directory=%2fapi" ) print(result) print() assert "xyz" in r
def test_get(self): HEADING() src = path_expand("~/.cloudmesh/storage/test/source/test/source/") dst = 'Useful Links.txt' # fetching files from dst to src # file = self.p.get(source=src, destination=dst, recursive=False) file = run(f"cms get {src} {dst}") assert file is not None
def test_openapi_azure_storage_list(self): banner('list the blobs') storage = self.storage #result = run( # "curl http://localhost:8080/cloudmesh/list_blob?service=azureblob'&'directory=%2ftest'&'recursive=True") result = run( f"curl http://localhost:8080/cloudmesh/list_blob?service={storage}'&'directory=%2ftest'&'recursive=True" ) print(result) print()
def test_01_put(self): HEADING() src = path_expand("~/.cloudmesh/storage/test/source/test/source/sample_source.txt") dst = "/" # Put files from src into google drive home directory test_file = run(f"cms put {src} {dst}") # test_file = self.p.put(source=src, destination=dst, recursive=False) print(test_file) assert test_file is not None
def execute(command): StopWatch.start(command) output = run(command) StopWatch.stop(command) return output