1
0

Print errors in test for confidence

This commit is contained in:
David Robertson
2022-07-05 19:42:33 +01:00
parent 44ac98422c
commit bfa3ae3d3b

View File

@@ -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)