make check and test more robust
This commit is contained in:
parent
b29860e34d
commit
8c5aaaabd1
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue