Added tests to verify that we can retrieve a specific number of activities from Buzz _without_ OAuth credentials
This commit is contained in:
@@ -96,6 +96,9 @@ class BuzzGaeClient(object):
|
|||||||
d.update(access_token)
|
d.update(access_token)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def build_api_client(self, oauth_params):
|
def build_api_client(self, oauth_params=None):
|
||||||
|
if oauth_params is not None:
|
||||||
http = oauth_wrap.get_authorised_http(oauth_params)
|
http = oauth_wrap.get_authorised_http(oauth_params)
|
||||||
return apiclient.discovery.build('buzz', 'v1', http = http)
|
return apiclient.discovery.build('buzz', 'v1', http = http)
|
||||||
|
else:
|
||||||
|
return apiclient.discovery.build('buzz', 'v1')
|
||||||
|
|||||||
@@ -63,5 +63,12 @@ class BuzzGaeClientTest(unittest.TestCase):
|
|||||||
api_client = client.build_api_client(oauth_parameters)
|
api_client = client.build_api_client(oauth_parameters)
|
||||||
self.assertTrue(api_client is not None)
|
self.assertTrue(api_client is not None)
|
||||||
|
|
||||||
|
def test_can_fetch_activites_from_buzz(self):
|
||||||
|
client = buzz_gae_client.BuzzGaeClient()
|
||||||
|
api_client = client.build_api_client()
|
||||||
|
count = 9
|
||||||
|
activities = api_client.activities().list(userId='googlebuzz', scope='@self', max_results=count)['items']
|
||||||
|
self.assertEquals(count, len(activities))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in New Issue
Block a user