2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-24 01:47:39 +00:00

make check and test more robust

This commit is contained in:
Matthias Mair
2025-10-18 21:50:29 +02:00
parent b29860e34d
commit 8c5aaaabd1
2 changed files with 7 additions and 2 deletions

View File

@@ -227,8 +227,10 @@ class OutputOptionsMixin:
super().__init__()
# Check that the serializer was defined
if hasattr(self, 'serializer_class') and (
not issubclass(self.serializer_class, FilterableSerializerMixin)
if (
hasattr(self, 'serializer_class')
and isinstance(self.serializer_class, type)
and (not issubclass(self.serializer_class, FilterableSerializerMixin))
):
raise Exception(
'INVE-I2: `OutputOptionsMixin` can only be used with serializers that contain the `FilterableSerializerMixin` mixin'

View File

@@ -191,6 +191,9 @@ class FilteredSerializers(InvenTreeAPITestCase):
view = BadList()
self.assertTrue(True)
# mock some stuff to allow get_serializer to run
view.request = self.client.request()
view.format_kwarg = {}
view.get_serializer() # this should raise an exception
self.assertEqual(