@@ -12,6 +12,7 @@ def setup
1212 @account_name = ENV [ "AZURE_ACCOUNT_NAME" ]
1313 @access_key = ENV [ "AZURE_ACCESS_KEY" ]
1414 @container = ENV [ "AZURE_PRIVATE_CONTAINER" ]
15+ @public_container = ENV [ "AZURE_PUBLIC_CONTAINER" ]
1516 @principal_id = ENV [ "AZURE_PRINCIPAL_ID" ]
1617 @host = ENV [ "STORAGE_BLOB_HOST" ]
1718 @client = AzureBlob ::Client . new (
@@ -409,4 +410,26 @@ def test_get_blob_tags
409410
410411 assert_equal ( { "tag1" => "value 1" , "tag 2" => "value 2" } , tags )
411412 end
413+
414+ def test_copy_between_containers
415+ destination_client = AzureBlob ::Client . new (
416+ account_name : @account_name ,
417+ access_key : @access_key ,
418+ container : @public_container ,
419+ principal_id : @principal_id ,
420+ host : @host ,
421+ )
422+ client . create_block_blob ( key , content )
423+ assert_equal content , client . get_blob ( key )
424+
425+ destination_client . copy_blob ( key , key , source_client : client )
426+
427+
428+ assert_equal content , destination_client . get_blob ( key )
429+
430+ begin
431+ destination_client . delete_blob ( key )
432+ rescue AzureBlob ::Http ::FileNotFoundError
433+ end
434+ end
412435end
0 commit comments