diff --git a/taiga/webhooks/serializers.py b/taiga/webhooks/serializers.py index f72a92ba..01d0c025 100644 --- a/taiga/webhooks/serializers.py +++ b/taiga/webhooks/serializers.py @@ -141,6 +141,9 @@ def custom_attributes_queryset(self, project): raise NotImplementedError() def get_custom_attributes_values(self, obj): + if not obj: + return None + def _use_name_instead_id_as_key_in_custom_attributes_values(custom_attributes, values): ret = {} for attr in custom_attributes: diff --git a/tests/integration/test_webhook_serializers.py b/tests/integration/test_webhook_serializers.py new file mode 100644 index 00000000..19f125e9 --- /dev/null +++ b/tests/integration/test_webhook_serializers.py @@ -0,0 +1,12 @@ +import taiga.webhooks.serializers + + +class TestCustomAttributesValuesWebhookSerializerMixin: + webhook_serializer_mixin = ( + taiga.webhooks.serializers.CustomAttributesValuesWebhookSerializerMixin + ) + + def test_get_custom_attributes_values(self): + assert ( + self.webhook_serializer_mixin().get_custom_attributes_values(None) is None + )