Fixed exceptions test after adding logging

This commit is contained in:
CasVT
2023-07-04 13:52:16 +02:00
parent c9a60f1b48
commit b73ac3bcde

View File

@@ -7,9 +7,19 @@ import backend.custom_exceptions
class Test_Custom_Exceptions(unittest.TestCase):
def test_type(self):
defined_exceptions: List[Exception] = filter(lambda c: c.__module__ == 'backend.custom_exceptions', map(lambda c: c[1], getmembers(modules['backend.custom_exceptions'], isclass)))
defined_exceptions: List[Exception] = filter(
lambda c: c.__module__ == 'backend.custom_exceptions' and c is not backend.custom_exceptions.CustomException,
map(
lambda c: c[1],
getmembers(modules['backend.custom_exceptions'], isclass)
)
)
for defined_exception in defined_exceptions:
self.assertEqual(getmro(defined_exception)[1], Exception)
self.assertEqual(
getmro(defined_exception)[1],
backend.custom_exceptions.CustomException
)
result = defined_exception().api_response
self.assertIsInstance(result, dict)
result['error']