def test_new(self): GooglePlusService.call('http placeholder', 'people.get', userId='me')\ .AndReturn({'id': '1', 'displayName': 'Mr. Foo', 'url': 'http://my.g+/url', 'image': {'url': 'http://my.pic/small'}, }) self.mox.ReplayAll() gp = GooglePlus.new(self.handler, http='http placeholder') self.assertEqual('1', gp.key().name()) self.assertEqual('Mr. Foo', gp.name) self.assertEqual('http://my.pic/small', gp.picture) self.assertEqual('http://my.g+/url', gp.url) self.assertEqual(self.current_user_id, gp.owner.key().name())
def test_get_salmon(self): # this one should be dropped without_link = copy.deepcopy(ACTIVITY_SALMON_VARS) without_link['in_reply_to'] = None GooglePlusService.call_with_creds('my gae user id', 'activities.list', userId='x', collection='public', maxResults=100)\ .AndReturn({'items': [ACTIVITY_JSON, without_link]}) GooglePlusService.call_with_creds('my gae user id', 'comments.list', activityId='123', maxResults=100)\ .AndReturn({'items': [COMMENT_JSON]}) self.mox.ReplayAll() self.googleplus.owner = models.User(key_name='my gae user id') self.assert_equals([ACTIVITY_SALMON_VARS, COMMENT_SALMON_VARS], self.googleplus.get_salmon())