def setUp(self):
self.clientquery = {'property_uri': 'https://www.example.com/',
'siteMode': 'en-us',
'clientName': 'Example',
'query_date': '2016-09-01'}
self.emptyresponse = '''{"responseAggregationType": "byPage"}'''
self.p = (os.path.dirname(os.path.abspath(__file__)))
self.build_response_data = '%s/build_response_data.json' % (self.p)
self.http_auth = HttpMockSequence([
({'status': '200'}, open(self.build_response_data, 'rb').read()),
({'status': '200'}, self.emptyresponse.encode('UTF-8'))
])
self.service = build('webmasters',
'v3',
http=self.http_auth,
developerKey='mocked_api_key_1234')
# Mock the service attribute within Apiclient
self.mocked_prop = PropertyMock(return_value=self.service)
评论列表
文章目录