Move HttpMock out of tests and into apiclient.http. Update tests that used HttpMock
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index 541210c..7c00bb9 100644
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -32,7 +32,13 @@
     from cgi import parse_qs
 
 from apiclient.discovery import build, key2param
-from tests.util import HttpMock
+from apiclient.http import HttpMock
+
+
+DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
+
+def datafile(filename):
+  return os.path.join(DATA_DIR, filename)
 
 
 class Utilities(unittest.TestCase):
@@ -44,7 +50,7 @@
 class Discovery(unittest.TestCase):
 
   def test_method_error_checking(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http)
 
     # Missing required parameters
@@ -76,7 +82,7 @@
       self.assertTrue('unexpected' in str(e))
 
   def test_buzz_resources(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http)
     self.assertTrue(getattr(buzz, 'activities'))
     self.assertTrue(getattr(buzz, 'feeds'))
@@ -87,7 +93,7 @@
     self.assertTrue(getattr(buzz, 'related'))
 
   def test_auth(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http)
     auth = buzz.auth_discovery()
     self.assertTrue('request' in auth)
@@ -95,7 +101,7 @@
   def test_full_featured(self):
     # Zoo should exercise all discovery facets
     # and should also have no future.json file.
-    self.http = HttpMock('zoo.json', {'status': '200'})
+    self.http = HttpMock(datafile('zoo.json'), {'status': '200'})
     zoo = build('zoo', 'v1', self.http)
     self.assertTrue(getattr(zoo, 'animals'))
     request = zoo.animals().list(name="bat", projection="size")
@@ -105,7 +111,7 @@
     self.assertEqual(q['projection'], ['size'])
 
   def test_nested_resources(self):
-    self.http = HttpMock('zoo.json', {'status': '200'})
+    self.http = HttpMock(datafile('zoo.json'), {'status': '200'})
     zoo = build('zoo', 'v1', self.http)
     self.assertTrue(getattr(zoo, 'animals'))
     request = zoo.my().favorites().list(max_results="5")
@@ -114,7 +120,7 @@
     self.assertEqual(q['max-results'], ['5'])
 
   def test_top_level_functions(self):
-    self.http = HttpMock('zoo.json', {'status': '200'})
+    self.http = HttpMock(datafile('zoo.json'), {'status': '200'})
     zoo = build('zoo', 'v1', self.http)
     self.assertTrue(getattr(zoo, 'query'))
     request = zoo.query(q="foo")
@@ -125,7 +131,7 @@
 
 class Next(unittest.TestCase):
   def test_next_for_people_liked(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http)
     people = {'links':
                   {'next':
@@ -136,7 +142,7 @@
 
 class DeveloperKey(unittest.TestCase):
   def test_param(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http, developerKey='foobie_bletch')
     activities = {'links':
                   {'next':
@@ -147,7 +153,7 @@
     self.assertEqual(q['key'], ['foobie_bletch'])
 
   def test_next_for_activities_list(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
     buzz = build('buzz', 'v1', self.http, developerKey='foobie_bletch')
     activities = {'links':
                   {'next':
diff --git a/tests/test_mocks.py b/tests/test_mocks.py
index ee8ef26..2c66aab 100644
--- a/tests/test_mocks.py
+++ b/tests/test_mocks.py
@@ -24,15 +24,22 @@
 from apiclient.errors import HttpError
 from apiclient.discovery import build
 from apiclient.http import RequestMockBuilder
-from tests.util import HttpMock
+from apiclient.http import HttpMock
 
-import unittest
 import httplib2
+import os
+import unittest
+
+
+DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
+
+def datafile(filename):
+  return os.path.join(DATA_DIR, filename)
 
 
 class Mocks(unittest.TestCase):
   def setUp(self):
-    self.http = HttpMock('buzz.json', {'status': '200'})
+    self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
 
   def test_default_response(self):
     requestBuilder = RequestMockBuilder({})
diff --git a/tests/util.py b/tests/util.py
deleted file mode 100644
index 101079f..0000000
--- a/tests/util.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2010 Google Inc. All Rights Reserved.
-
-"""One-line documentation for util module.
-
-A detailed description of util.
-"""
-
-__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-
-import httplib2
-import os
-
-DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
-
-
-class HttpMock(object):
-
-  def __init__(self, filename, headers):
-    f = file(os.path.join(DATA_DIR, filename), 'r')
-    self.data = f.read()
-    f.close()
-    self.headers = headers
-
-  def request(self, uri, method="GET", body=None, headers=None, redirections=1, connection_type=None):
-    return httplib2.Response(self.headers), self.data