Skip to content

Force HttpMock to read content from file as bytes#125

Merged
nathanielmanistaatgoogle merged 1 commit into
googleapis:masterfrom
alanbriolat:httpmock-bytes
Aug 13, 2015
Merged

Force HttpMock to read content from file as bytes#125
nathanielmanistaatgoogle merged 1 commit into
googleapis:masterfrom
alanbriolat:httpmock-bytes

Conversation

@alanbriolat
Copy link
Copy Markdown
Contributor

Fixes #124.

I decided to write the test for the functionality I was actually trying to use, and which was previously not covered by tests: using HttpMock specifically to mock error responses. The side effect is that it exposes how HttpMock was not not reading content as bytes on Python 3 and causing a confusing exception to be thrown.

I think the fix speaks for itself...

@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Aug 13, 2015
@alanbriolat
Copy link
Copy Markdown
Contributor Author

CLA has now been signed.

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Aug 13, 2015
@nathanielmanistaatgoogle
Copy link
Copy Markdown
Contributor

A one-byte fix? Are we sure there's not something less drastic we could do instead? :-P

nathanielmanistaatgoogle added a commit that referenced this pull request Aug 13, 2015
Force HttpMock to read content from file as bytes.
@nathanielmanistaatgoogle nathanielmanistaatgoogle merged commit a98add2 into googleapis:master Aug 13, 2015
@nathanielmanistaatgoogle
Copy link
Copy Markdown
Contributor

Thanks for the contribution!

alanbriolat added a commit to alanbriolat/csbot that referenced this pull request Aug 14, 2015
Test cases will only apply when a new version of google-api-python-client
is released, because of a bug in the apiclient.http.HttpMock class
(see googleapis/google-api-python-client#125).

fixes HackSoc#103 (and HackSoc#99)
alanbriolat added a commit to alanbriolat/csbot that referenced this pull request Aug 14, 2015
Test cases will only apply when a new version of google-api-python-client
is released, because of a bug in the apiclient.http.HttpMock class
(see googleapis/google-api-python-client#125).

fixes HackSoc#103 (and HackSoc#99)
akrherz pushed a commit to akrherz/google-api-python-client that referenced this pull request Apr 1, 2019
Fixes googleapis#125.

NOTE: '%s.%s' does not behave the same between versions and should
      be removed throughout this library.

I will be following this up with a set of regression tests (hopefully
some of which will fail) and we can assess the damage of other uses
of '%s'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpMock response content should be bytes but isn't (in Python 3)

3 participants