Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Clean up usage of HTTP mocks in tests. #605

Merged
merged 1 commit into from
Aug 10, 2016

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Aug 10, 2016

This is a follow-on to #602, and partially making good on a comment I made in #586.

I checked the types of http values sent to transport.request by adding:

from tests import http_mock
import types
if type(http) == http_mock.HttpMock:
    pass
elif type(http) == http_mock.HttpMockSequence:
    pass
elif (type(http) == types.MethodType and
      http.__self__.__class__ == http_mock.HttpMock):
    pass
elif (type(http) == types.MethodType and
      http.__self__.__class__ == http_mock.HttpMockSequence):
    pass
elif (type(http) == types.FunctionType and
      http.__name__ == 'new_request'):
    pass
else:
    raise MyErr(http)

I also did git grep http_request to find some other iffy usage. I'd also like to track down usage of http.request (or just .request on an object).

The method type and function type checks are to accommodate the hacky way an http object is monkey-patched, so I'd also like to fix those up as part of #128.

@@ -705,8 +702,8 @@ def test_get_adc_env_from_well_known(self, *stubs):
# Make sure the well-known file actually doesn't exist.
self.assertTrue(os.path.exists(get_well_known.return_value))

method_name = \
'oauth2client.client._get_application_default_credential_from_file'
method_name = ('oauth2client.client.'

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@theacodes
Copy link
Contributor

This looks good to me.

@dhermes
Copy link
Contributor Author

dhermes commented Aug 10, 2016

@jonparrott What do you have against the acronym LGTM 😉

@theacodes
Copy link
Contributor

I don't know.

On Wed, Aug 10, 2016 at 3:09 PM Danny Hermes notifications@github.com
wrote:

@jonparrott https://github.com/jonparrott What do you have against the
acronym LGTM 😉


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#605 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc-NkRPCpRWm8flFvwFUQbw2nfwp-ks5qekwTgaJpZM4JhlMl
.

@dhermes dhermes merged commit 2c44207 into googleapis:master Aug 10, 2016
@dhermes dhermes deleted the unify-http-mocks branch August 10, 2016 22:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants