merge
diff --git a/apiclient/discovery.py b/apiclient/discovery.py
index 0b441b1..8aba7ef 100644
--- a/apiclient/discovery.py
+++ b/apiclient/discovery.py
@@ -236,8 +236,14 @@
headers, params, query, body = self._model.request(headers,
actual_path_params, actual_query_params, body_value)
+ # TODO(ade) This exists to fix a bug in V1 of the Buzz discovery document.
+ # Base URLs should not contain any path elements. If they do then urlparse.urljoin will strip them out
+ # This results in an incorrect URL which returns a 404
+ url_result = urlparse.urlsplit(self._baseUrl)
+ new_base_url = url_result.scheme + '://' + url_result.netloc
+
expanded_url = uritemplate.expand(pathUrl, params)
- url = urlparse.urljoin(self._baseUrl, expanded_url + query)
+ url = urlparse.urljoin(new_base_url, url_result.path + expanded_url + query)
logging.info('URL being requested: %s' % url)
return HttpRequest(self._http, url, method=httpMethod, body=body,
diff --git a/functional_tests/test_services.py b/functional_tests/test_services.py
index 7cf5a5d..7665d4b 100644
--- a/functional_tests/test_services.py
+++ b/functional_tests/test_services.py
@@ -75,5 +75,29 @@
people_count = len(people['items'])
self.assertEquals(max_results, people_count, 'Failed after %s pages' % str(count))
+ def test_can_get_user_profile(self):
+ buzz = build('buzz', 'v1')
+ person = buzz.people().get(userId='googlebuzz').execute()
+
+ self.assertTrue(person is not None)
+ self.assertEquals('buzz#person', person['kind'])
+ self.assertEquals('Google Buzz Team', person['displayName'])
+ self.assertEquals('111062888259659218284', person['id'])
+ self.assertEquals('http://www.google.com/profiles/googlebuzz', person['profileUrl'])
+
+
+class BuzzAuthenticatedFunctionalTest(unittest.TestCase):
+ def IGNORE__test_can_list_groups_belonging_to_user(self):
+ buzz = build('buzz', 'v1')
+ groups = buzz.groups().list(userId='googlebuzz').execute()
+
+ self.assertTrue(len(groups) > 1)
+
+ def IGNORE__test_can_get_followees_of_user(self):
+ buzz = build('buzz', 'v1')
+ following = buzz.groups().get(userId='googlebuzz', groupId='@following').execute()
+
+ self.assertEquals(17, len(following))
+
if __name__ == '__main__':
unittest.main()