mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
prevent modified from showing up in activity stream
This commit is contained in:
parent
8c3b1c06d9
commit
48112f2c56
@ -400,6 +400,12 @@ model_serializer_mapping = {
|
||||
AdHocCommand: AdHocCommandSerializer,
|
||||
NotificationTemplate: NotificationTemplateSerializer,
|
||||
Notification: NotificationSerializer,
|
||||
CredentialType: CredentialTypeSerializer,
|
||||
Schedule: ScheduleSerializer,
|
||||
Label: LabelSerializer,
|
||||
WorkflowJobTemplate: WorkflowJobTemplateSerializer,
|
||||
WorkflowJobTemplateNode: WorkflowJobTemplateNodeSerializer,
|
||||
WorkflowJob: WorkflowJobSerializer,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ from awx.main.models import (
|
||||
|
||||
# other AWX
|
||||
from awx.main.utils import model_to_dict
|
||||
from awx.main.utils.common import get_allowed_fields
|
||||
from awx.api.serializers import InventorySourceSerializer
|
||||
|
||||
# Django
|
||||
@ -181,3 +182,20 @@ def test_annon_user_action():
|
||||
inv = Inventory.objects.create(name='ainventory')
|
||||
entry = inv.activitystream_set.filter(operation='create').first()
|
||||
assert not entry.actor
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_modified_not_allowed_field(somecloud_type):
|
||||
'''
|
||||
If this test fails, that means that read-only fields are showing
|
||||
up in the activity stream serialization of an instance.
|
||||
|
||||
That _probably_ means that you just connected a new model to the
|
||||
activity_stream_registrar, but did not add its serializer to
|
||||
the model->serializer mapping.
|
||||
'''
|
||||
from awx.main.signals import model_serializer_mapping
|
||||
from awx.main.registrar import activity_stream_registrar
|
||||
|
||||
for Model in activity_stream_registrar.models:
|
||||
assert 'modified' not in get_allowed_fields(Model(), model_serializer_mapping), Model
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user