Skip to content

find json samples for HttpMocks #1628

Answered by parthea
b10n1k asked this question in Q&A
Dec 13, 2021 · 4 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @b10n1k!

For 'service_account_discovery.json' and iam_accounts.json you would need to create those files based on the actual API responses. Please see the 2nd note listed under the example.

Notes:

...
As you develop and test your application, it is a good idea to save actual API responses in files like books-discovery.json or books-android.json for use in testing.
...

Note, if you change

service = build('iam', 'v1', http=http, developerKey=secret_key)

to

service = build('iam', 'v1')

in your testing. You won't need to mock building of the client as the default behaviour for googleapiclient.discovery.build() is to fetch discovery artifacts which are shipped with the library rather th…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by parthea
Comment options

You must be logged in to vote
1 reply
@parthea
Comment options

Comment options

You must be logged in to vote
1 reply
@parthea
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants