Added oauth tokens for discoveryclientlibrarytest@gmail.com. First authentication test passes but it shouldn't need authentication. It seems we're adding a spurious @self to the URL
diff --git a/functional_tests/data/buzz_credentials.dat b/functional_tests/data/buzz_credentials.dat
new file mode 100644
index 0000000..91613e4
--- /dev/null
+++ b/functional_tests/data/buzz_credentials.dat
@@ -0,0 +1,50 @@
+ccopy_reg
+_reconstructor
+p0
+(capiclient.oauth
+OAuthCredentials
+p1
+c__builtin__
+object
+p2
+Ntp3
+Rp4
+(dp5
+S'token'
+p6
+g0
+(coauth2
+Token
+p7
+g2
+Ntp8
+Rp9
+(dp10
+S'secret'
+p11
+S'tsAddOKXxs7dypwkRTCSAvPV'
+p12
+sS'key'
+p13
+S'1/Krdi6C3n47g2ny13MdnZbj7AS77JdgaMVg2fDY7ZmwI'
+p14
+sbsS'consumer'
+p15
+g0
+(coauth2
+Consumer
+p16
+g2
+Ntp17
+Rp18
+(dp19
+g11
+S'anonymous'
+p20
+sg13
+g20
+sbsS'user_agent'
+p21
+S'google-api-client-python-buzz-cmdline/1.0'
+p22
+sb.
\ No newline at end of file
diff --git a/functional_tests/test_services.py b/functional_tests/test_services.py
index 7665d4b..6403946 100644
--- a/functional_tests/test_services.py
+++ b/functional_tests/test_services.py
@@ -16,6 +16,7 @@
from apiclient.discovery import build
import httplib2
import logging
+import pickle
import os
import unittest
@@ -87,14 +88,29 @@
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()
+ def __init__(self, method_name):
+ unittest.TestCase.__init__(self, method_name)
+ credentials_dir = os.path.join(logging.os.path.dirname(__file__), './data')
+ f = file(os.path.join(credentials_dir, 'buzz_credentials.dat'), 'r')
+ credentials = pickle.loads(f.read())
+ f.close()
- self.assertTrue(len(groups) > 1)
+ self.http = credentials.authorize(httplib2.Http())
+
+ def test_can_list_groups_belonging_to_user(self):
+ # TODO(ade) This should not require authentication. It does because we're adding a spurious @self to the URL
+ buzz = build('buzz', 'v1', http=self.http)
+ groups = buzz.groups().list(userId='108242092577082601423').execute()
+
+ # This should work as long as no-one edits the groups for this test account
+ expected_default_number_of_groups = 4
+ self.assertEquals(expected_default_number_of_groups, len(groups['items']))
def IGNORE__test_can_get_followees_of_user(self):
- buzz = build('buzz', 'v1')
+ # This currently fails with:
+ # Attempting to access self view of a different user.
+ # and URL:
+ buzz = build('buzz', 'v1', http=self.http)
following = buzz.groups().get(userId='googlebuzz', groupId='@following').execute()
self.assertEquals(17, len(following))