mirror of
https://github.com/ansible/awx.git
synced 2026-03-28 14:25:05 -02:30
prevent modified from showing up in activity stream
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user