h2non / gock

HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

Home Page:https://pkg.go.dev/github.com/h2non/gock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to test google api using gock?

milley23 opened this issue · comments

Hi, I am working with Google Analytics API , and need to create unit testing for that using gock. Is it possible?

how to mock this part ??
analyticsService, _ := analytics.NewService(ctx, option.WithCredentialsJSON(cred))

it asks me to put the real private key on Credential JSON or I will get this following error:
private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: structure error: tags don't match (16 vs {class:0 tag:8 length:1214 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey

Thank you.