summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-07-05 19:42:33 +0100
committerDavid Robertson <davidr@element.io>2022-07-05 19:42:33 +0100
commitbfa3ae3d3bb158fa022c88a63561d60994c3e1df (patch)
treed83d570639d22476eeac1ef45bc77440fc63e6d7 /tests
parentlint fixup (diff)
downloadsynapse-dmr/oidc-config-pydantic.tar.xz
Print errors in test for confidence github/dmr/oidc-config-pydantic dmr/oidc-config-pydantic
Diffstat (limited to '')
-rw-r--r--tests/config/test_oidc2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/config/test_oidc2.py b/tests/config/test_oidc2.py
index 3bff60214c..e5a9da68a7 100644
--- a/tests/config/test_oidc2.py
+++ b/tests/config/test_oidc2.py
@@ -1,3 +1,4 @@
+from contextlib import contextmanager
 from copy import deepcopy
 from typing import Any, Dict
 from unittest import TestCase
@@ -54,6 +55,15 @@ class PydanticOIDCTestCase(TestCase):
     def setUp(self) -> None:
         self.config = deepcopy(SAMPLE_CONFIG)
 
+    @contextmanager
+    def assertRaises(self, *args, **kwargs):
+        """To demonstrate the example error messages generated by Pydantic, uncomment
+        this method."""
+        with super().assertRaises(*args, **kwargs) as result:
+            yield result
+        print()
+        print(result.exception)
+
     def test_example_config(self):
         # Check that parsing the sample config doesn't raise an error.
         OIDCProviderModel.parse_obj(self.config)