mirror of
https://github.com/ansible/awx.git
synced 2026-04-05 01:59:25 -02:30
prevent modified from showing up in activity stream
This commit is contained in:
@@ -400,6 +400,12 @@ model_serializer_mapping = {
|
|||||||
AdHocCommand: AdHocCommandSerializer,
|
AdHocCommand: AdHocCommandSerializer,
|
||||||
NotificationTemplate: NotificationTemplateSerializer,
|
NotificationTemplate: NotificationTemplateSerializer,
|
||||||
Notification: NotificationSerializer,
|
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
|
# other AWX
|
||||||
from awx.main.utils import model_to_dict
|
from awx.main.utils import model_to_dict
|
||||||
|
from awx.main.utils.common import get_allowed_fields
|
||||||
from awx.api.serializers import InventorySourceSerializer
|
from awx.api.serializers import InventorySourceSerializer
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
@@ -181,3 +182,20 @@ def test_annon_user_action():
|
|||||||
inv = Inventory.objects.create(name='ainventory')
|
inv = Inventory.objects.create(name='ainventory')
|
||||||
entry = inv.activitystream_set.filter(operation='create').first()
|
entry = inv.activitystream_set.filter(operation='create').first()
|
||||||
assert not entry.actor
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user