mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Add messages field
This commit is contained in:
@@ -4125,7 +4125,8 @@ class NotificationTemplateSerializer(BaseSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = NotificationTemplate
|
model = NotificationTemplate
|
||||||
fields = ('*', 'organization', 'notification_type', 'notification_configuration')
|
fields = ('*', 'organization', 'notification_type', 'notification_configuration', 'messages')
|
||||||
|
|
||||||
|
|
||||||
type_map = {"string": (str,),
|
type_map = {"string": (str,),
|
||||||
"int": (int,),
|
"int": (int,),
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.20 on 2019-06-10 16:56
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import awx.main.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0082_v360_webhook_http_method'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationtemplate',
|
||||||
|
name='messages',
|
||||||
|
field=awx.main.fields.JSONField(default=dict,
|
||||||
|
help_text='Optional custom messages for notification template.',
|
||||||
|
null=True,
|
||||||
|
blank=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -68,6 +68,12 @@ class NotificationTemplate(CommonModelNameNotUnique):
|
|||||||
|
|
||||||
notification_configuration = JSONField(blank=False)
|
notification_configuration = JSONField(blank=False)
|
||||||
|
|
||||||
|
messages = JSONField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
default=dict,
|
||||||
|
help_text=_('Optional custom messages for notification template.'))
|
||||||
|
|
||||||
def get_absolute_url(self, request=None):
|
def get_absolute_url(self, request=None):
|
||||||
return reverse('api:notification_template_detail', kwargs={'pk': self.pk}, request=request)
|
return reverse('api:notification_template_detail', kwargs={'pk': self.pk}, request=request)
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ def test_basic_parameterization(get, post, user, organization):
|
|||||||
assert 'notification_configuration' in response.data
|
assert 'notification_configuration' in response.data
|
||||||
assert 'url' in response.data['notification_configuration']
|
assert 'url' in response.data['notification_configuration']
|
||||||
assert 'headers' in response.data['notification_configuration']
|
assert 'headers' in response.data['notification_configuration']
|
||||||
|
assert 'messages' in response.data
|
||||||
|
assert response.data['messages'] == {'started': None, 'success': None, 'error': None}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
Reference in New Issue
Block a user