Changed runtests.py so that it also runs the functional tests. Added functional tests for Buzz. Note that these log the URLs they hit to make debugging easier.
diff --git a/functional_tests/test_services.py b/functional_tests/test_services.py
new file mode 100644
index 0000000..d291dd3
--- /dev/null
+++ b/functional_tests/test_services.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python2.4
+#
+# Copyright 2010 Google Inc. All Rights Reserved.
+
+"""Discovery document tests
+
+Functional tests that verify we can retrieve data from existing services.
+
+These tests are read-only in order to ensure they're repeatable. They also
+only work with publicly visible data in order to avoid dealing with OAuth.
+"""
+
+__author__ = 'ade@google.com (Ade Oshineye)'
+
+from apiclient.discovery import build
+
+import logging
+import unittest
+
+logging.basicConfig(level=logging.DEBUG)
+
+
+class BuzzFunctionalTest(unittest.TestCase):
+ def test_can_get_buzz_activities_with_many_params(self):
+ buzz = build('buzz', 'v1')
+ max_results = 2
+ activities = buzz.activities().list(userId='googlebuzz', scope='@self',
+ max_comments=max_results*2 ,max_liked=max_results*3,
+ max_results=max_results)['items']
+ activity_count = len(activities)
+ self.assertEquals(max_results, activity_count)
diff --git a/runtests.py b/runtests.py
index bda6090..c66b728 100644
--- a/runtests.py
+++ b/runtests.py
@@ -10,19 +10,20 @@
sys.path.insert(0, os.getcwd())
-# find all of the test modules
-modules = map(fullmodname, glob.glob(os.path.join('tests', 'test_*.py')))
-print "Running the tests found in the following modules:"
-print modules
+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
-# load all of the tests into a suite
-try:
- suite = unittest.TestLoader().loadTestsFromNames(modules)
-except Exception, exception:
- # attempt to produce a more specific message
- for module in modules:
- __import__(module)
- raise
+ # load all of the tests into a suite
+ try:
+ return unittest.TestLoader().loadTestsFromNames(modules)
+ except Exception, exception:
+ # attempt to produce a more specific message
+ for module in modules:
+ __import__(module)
+ raise
verbosity = 1
if "-q" in sys.argv or '--quiet' in sys.argv:
@@ -30,8 +31,10 @@
if "-v" in sys.argv or '--verbose' in sys.argv:
verbosity = 2
-# run test suite
-unittest.TextTestRunner(verbosity=verbosity).run(suite)
+unit_tests = build_suite('tests')
+functional_tests = build_suite('functional_tests')
+# run test suites
+unittest.TextTestRunner(verbosity=verbosity).run(unit_tests)
+unittest.TextTestRunner(verbosity=verbosity).run(functional_tests)
cleanup()
-