Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy_object: support passing another request options #513

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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