From db849af1b99d7274152ba51aa0cd4b7ec2fcc932 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Wed, 22 Sep 2010 16:53:59 -0400 Subject: [PATCH] Fixes for some coverage tests. Also fix functional test, and make verbosity controls apply better. --- apiclient/discovery.py | 4 ++-- functional_tests/test_services.py | 12 ++++++++---- runtests.py | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apiclient/discovery.py b/apiclient/discovery.py index 9eec549..3d30fbd 100644 --- a/apiclient/discovery.py +++ b/apiclient/discovery.py @@ -30,9 +30,9 @@ import urllib import urlparse from apiclient.http import HttpRequest -try: +try: # pragma: no cover import simplejson -except ImportError: +except ImportError: # pragma: no cover try: # Try to import from django, should work on App Engine from django.utils import simplejson diff --git a/functional_tests/test_services.py b/functional_tests/test_services.py index e82ec24..ae197ba 100644 --- a/functional_tests/test_services.py +++ b/functional_tests/test_services.py @@ -27,9 +27,13 @@ class BuzzFunctionalTest(unittest.TestCase): actcol = buzz.activities() activities = actcol.list(userId='googlebuzz', scope='@self', max_comments=max_results*2 ,max_liked=max_results*3, - max_results=max_results).execute()['items'] - activity_count = len(activities) + max_results=max_results).execute() + activity_count = len(activities['items']) self.assertEquals(max_results, activity_count) - activities = actcol.list_next(activities) - self.assertEquals(activities, None) # Public streams don't have next links + activities = actcol.list_next(activities).execute() + activity_count = len(activities['items']) + self.assertEquals(max_results, activity_count) + +if __name__ == '__main__': + unittest.main() diff --git a/runtests.py b/runtests.py index 4502baf..d12b2c5 100644 --- a/runtests.py +++ b/runtests.py @@ -31,8 +31,9 @@ elif verbosity == 2: def build_suite(folder): # find all of the test modules modules = map(fullmodname, glob.glob(os.path.join(folder, 'test_*.py'))) - print "Running the tests found in the following modules:" - print modules + if verbosity > 0: + print "Running the tests found in the following modules:" + print modules # load all of the tests into a suite try: