Adding back "wrapped" exceptions in Refresh/Transport errors.
diff --git a/tests/compute_engine/test_credentials.py b/tests/compute_engine/test_credentials.py
index c78511b..ae2597d 100644
--- a/tests/compute_engine/test_credentials.py
+++ b/tests/compute_engine/test_credentials.py
@@ -75,9 +75,11 @@
def test_refresh_error(self, get):
get.side_effect = exceptions.TransportError('http error')
- with pytest.raises(exceptions.RefreshError):
+ with pytest.raises(exceptions.RefreshError) as excinfo:
self.credentials.refresh(None)
+ assert excinfo.match(r'http error')
+
@mock.patch('google.auth.compute_engine._metadata.get', autospec=True)
def test_before_request_refreshes(self, get):
get.side_effect = [{
diff --git a/tests/test__default.py b/tests/test__default.py
index 090cea6..2df8a44 100644
--- a/tests/test__default.py
+++ b/tests/test__default.py
@@ -85,6 +85,7 @@
_default._load_credentials_from_file(str(filename))
assert excinfo.match(r'Failed to load authorized user')
+ assert excinfo.match(r'missing fields')
def test__load_credentials_from_file_service_account():
@@ -102,6 +103,7 @@
_default._load_credentials_from_file(str(filename))
assert excinfo.match(r'Failed to load service account')
+ assert excinfo.match(r'missing fields')
@mock.patch.dict(os.environ, {}, clear=True)