diff options
author | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-07-29 11:24:17 -0700 |
---|---|---|
committer | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-08-01 15:08:46 -0700 |
commit | 80fff4bda1be77c479c954cdf5ad8a2ba238cf6d (patch) | |
tree | 4a39d91b340a4297a761322ba704bc713a3a6785 /tests | |
parent | eb019c2dadfbcefccfcaff4d58fc2112ed584825 (diff) | |
download | oauth2client-80fff4bda1be77c479c954cdf5ad8a2ba238cf6d.tar.gz |
Remove httplib2 imports from non-transport modules.
Now all usage of httplib2 is concentrated in tests and
in the oauth2client.transport module. This does not yet
cover all behavior that implicitly relies on httplib2
in these modules, so there is still work to be done.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/contrib/test_metadata.py | 2 | ||||
-rw-r--r-- | tests/test_transport.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/contrib/test_metadata.py b/tests/contrib/test_metadata.py index 7f11d04..39d7291 100644 --- a/tests/contrib/test_metadata.py +++ b/tests/contrib/test_metadata.py @@ -62,7 +62,7 @@ class TestMetadata(unittest2.TestCase): def test_get_failure(self): http_request = request_mock( http_client.NOT_FOUND, 'text/html', '<p>Error</p>') - with self.assertRaises(httplib2.HttpLib2Error): + with self.assertRaises(http_client.HTTPException): _metadata.get(http_request, PATH) http_request.assert_called_once_with(EXPECTED_URL, **EXPECTED_KWARGS) diff --git a/tests/test_transport.py b/tests/test_transport.py index e9782a8..f783ed2 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -52,6 +52,13 @@ class Test_get_http_object(unittest2.TestCase): def test_it(self, http_klass): result = transport.get_http_object() self.assertEqual(result, http_klass.return_value) + http_klass.assert_called_once_with() + + @mock.patch.object(httplib2, 'Http', return_value=object()) + def test_with_args(self, http_klass): + result = transport.get_http_object(1, 2, foo='bar') + self.assertEqual(result, http_klass.return_value) + http_klass.assert_called_once_with(1, 2, foo='bar') class Test__initialize_headers(unittest2.TestCase): |