Mocking the Discovery Document

54 views
Skip to first unread message

ross....@udemy.com

unread,
Jun 5, 2015, 4:08:35 PM6/5/15
to google-api-p...@googlegroups.com
I am trying to mock the http response for the build.discovery call as outlined in this example:

However, I cannot figure out how to generate the books-discovery.json. When I make the call for realz I get a googleapiclient.discovery.Resource object, which doesn't have any methods for converting into JSON. 

Code snippet:

        self.__http = Http()
        self.__http = HttpMock(
                os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests', 'discovery.json'), # how do I generate this?
                {'status': '200'}
        )
        result = discovery.build('androidpublisher', 'v2', http=self.__http)


Any advice would be appreciated!

Ross

Ross Larner

unread,
Nov 14, 2015, 11:28:28 AM11/14/15
to Google API Python Client
I managed to solve this by capturing grabbing the request directly off the http object from a real request.
Reply all
Reply to author
Forward
0 new messages