mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 19:35:02 -02:30
Fix up organization default exposed by unit test
This commit is contained in:
@@ -2427,9 +2427,13 @@ class NotificationTemplateSerializer(BaseSerializer):
|
|||||||
notification_type = attrs['notification_type']
|
notification_type = attrs['notification_type']
|
||||||
elif self.instance:
|
elif self.instance:
|
||||||
notification_type = self.instance.notification_type
|
notification_type = self.instance.notification_type
|
||||||
|
if 'organization' in attrs:
|
||||||
|
organization = attrs['organization']
|
||||||
|
elif self.instance:
|
||||||
|
organization = self.instance.organization
|
||||||
if not notification_type:
|
if not notification_type:
|
||||||
raise serializers.ValidationError('Missing required fields for Notification Configuration: notification_type')
|
raise serializers.ValidationError('Missing required fields for Notification Configuration: notification_type')
|
||||||
if 'organization' not in attrs:
|
if not organization:
|
||||||
raise serializers.ValidationError("Missing 'organization' from required fields")
|
raise serializers.ValidationError("Missing 'organization' from required fields")
|
||||||
|
|
||||||
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[notification_type]
|
notification_class = NotificationTemplate.CLASS_FOR_NOTIFICATION_TYPE[notification_type]
|
||||||
|
|||||||
Reference in New Issue
Block a user