Backend Refactor

This commit is contained in:
CasVT
2024-02-01 14:42:10 +01:00
parent a8b85a975f
commit ccdb16eef5
20 changed files with 1735 additions and 1071 deletions

View File

@@ -8,7 +8,8 @@ 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' and c is not backend.custom_exceptions.CustomException,
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)
@@ -16,11 +17,21 @@ class Test_Custom_Exceptions(unittest.TestCase):
)
for defined_exception in defined_exceptions:
self.assertEqual(
self.assertIn(
getmro(defined_exception)[1],
backend.custom_exceptions.CustomException
(
backend.custom_exceptions.CustomException,
Exception
)
)
result = defined_exception().api_response
try:
result = defined_exception().api_response
except TypeError:
try:
result = defined_exception('1').api_response
except TypeError:
result = defined_exception('1', '2').api_response
self.assertIsInstance(result, dict)
result['error']
result['result']