dnaeon / go-vcr

Record and replay your HTTP interactions for fast, deterministic and accurate tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-vcr and using it to test GitHub Client with Oauth 2

joesustaric opened this issue · comments

Hi there,

I'd like to use this library to test with the GitHub client.

From their docs I would need to inject an Oauth2 client to handle the Oauth2 dance
https://github.com/google/go-github/blob/master/example/tokenauth/main.go#L29

Is it possible to use go-vcr with an Oauth2 client to save responses and replay them later?

My understanding is that the recorder needs to be injected into the client as the Transport https://github.com/dnaeon/go-vcr/blob/master/example/https_test.go#L46

I'm still poking around both libraries but don't know a lot about the internals of the Oauth2 and http libraries. Is this even possible?

Any assistance would be appreciated

Thanks

Hey @joesustaric ,

Please check issue #59, which discusses go-github and go-vcr in particular.

Oh yes thank you - I think that's what I needed.

👍