mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-24 18:07:38 +00:00
make check and test more robust
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user