Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle missing object in CustomAttributesValuesWebhookSerializer #166

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions taiga/webhooks/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/test_webhook_serializers.py
Original file line number Diff line number Diff line change
@@ -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
)
Loading