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

Added test on put_object with nil as object body #351

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

vimutter
Copy link
Contributor

@vimutter vimutter commented Jun 4, 2018

We had some unclear situation while were testing file uploads. When we sent nil we got ClientError stating that URL is bad and should be starting from /upload. All of that were caused by invalid/unexpected command being created https://github.com/google/google-api-ruby-client/blob/e3b8c800d649da00748d4605d847b342480ecc73/generated/google/apis/storage_v1/service.rb#L1795

@@ -14,6 +14,12 @@ def test_put_object_string
assert_equal(object_name, object[:name])
assert_equal(temp_file_content, object[:body])
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@@ -78,6 +67,25 @@ def put_object(bucket_name,
:upload_source => data
)
end

protected

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@@ -78,6 +67,25 @@ def put_object(bucket_name,
:upload_source => data
)
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@Temikus
Copy link
Member

Temikus commented Jun 5, 2018

This is great, thank you!

I'll kick off the Integration tests, once those pass we can merge.

@Temikus
Copy link
Member

Temikus commented Jun 5, 2018

@vimutter Seems good, only the new test fails. object_name is not instantiated.

  1) Failure:
TestStorageRequests#test_put_object_nil [/tmp/build/453021c2/src/fog-google/test/integration/storage/test_objects.rb:19]:
[ArgumentError] exception expected, not
Class: <NameError>
Message: <"undefined local variable or method `object_name' for #<TestStorageRequests:0x00000004dd2e40>\nDid you mean?  object_id">
---Backtrace---
/tmp/build/453021c2/src/fog-google/test/integration/storage/test_objects.rb:20:in `block in test_put_object_nil'
---------------

@vimutter
Copy link
Contributor Author

vimutter commented Jun 5, 2018 via email

Fix trailing spaces
Added data presence check to put_object
`Fog::Storage::GoogleJSON.put_object` to be precise
@vimutter
Copy link
Contributor Author

vimutter commented Jun 5, 2018

@Temikus Sorry for failing tests, was making changes via github UI. Updated PR

@Temikus
Copy link
Member

Temikus commented Jun 5, 2018

No worries at all! Thank you very much for your contribution @vimutter!

@Temikus
Copy link
Member

Temikus commented Jun 5, 2018

I’ll merge this tomorrow morning - GitHub is being temperamental on iOS due to check status.

@Temikus Temikus merged commit 2c0dece into fog:master Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants