Skip to content

Commit

Permalink
Merge pull request #513 from yosiat/support-predefined-acl
Browse files Browse the repository at this point in the history
copy_object: support passing another request options
  • Loading branch information
Temikus authored Dec 16, 2020
2 parents 596af01 + fee365b commit bac1c2b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fog/storage/google_json/requests/copy_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class Real
def copy_object(source_bucket, source_object,
target_bucket, target_object, options = {})
request_options = ::Google::Apis::RequestOptions.default.merge(options)

@storage_json.copy_object(source_bucket, source_object,
target_bucket, target_object,
request_options)
request_options, **options)
end
end

Expand Down
16 changes: 16 additions & 0 deletions test/integration/storage/test_objects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "securerandom"
require "base64"
require "tempfile"
require "net/http"

class TestStorageRequests < StorageShared
def test_put_object_string
Expand Down Expand Up @@ -93,10 +94,25 @@ def test_copy_object

@client.copy_object(some_bucket_name, some_object_name,
some_bucket_name, target_object_name)

object = @client.get_object(some_bucket_name, target_object_name)

assert_equal(temp_file_content, object[:body])
end

def test_copy_object_predefined_acl
target_object_name = new_object_name

res = @client.copy_object(some_bucket_name, some_object_name,
some_bucket_name, target_object_name, destination_predefined_acl: "publicRead")

result = @client.get_object(some_bucket_name, target_object_name)

response = Net::HTTP.get_response(URI(result[:self_link]))

assert_kind_of(Net::HTTPOK, response)
end

def test_list_objects
expected_object = some_object_name

Expand Down

0 comments on commit bac1c2b

Please sign in to comment.