mirror of
https://github.com/ansible/awx.git
synced 2026-06-24 16:17:51 -02:30
test updates
* when tests create a UnifiedJob and JobEvent, the two need to have the same value for job creation time * some view validation was skipped due to `model` being a property in some cases now
This commit is contained in:
@@ -55,6 +55,8 @@ def test_list_views_use_list_serializers(all_views):
|
||||
"""
|
||||
list_serializers = tuple(getattr(serializers, '{}ListSerializer'.format(cls.__name__)) for cls in (UnifiedJob.__subclasses__() + [UnifiedJob]))
|
||||
for View in all_views:
|
||||
if type(View.model) is property:
|
||||
continue # special case for JobEventChildrenList
|
||||
if hasattr(View, 'model') and issubclass(getattr(View, 'model'), UnifiedJob):
|
||||
if issubclass(View, ListAPIView):
|
||||
assert issubclass(View.serializer_class, list_serializers), 'View {} serializer {} is not a list serializer'.format(View, View.serializer_class)
|
||||
|
||||
@@ -73,6 +73,8 @@ def test_global_creation_always_possible(all_views):
|
||||
views_by_model = {}
|
||||
for View in all_views:
|
||||
if not getattr(View, 'deprecated', False) and issubclass(View, ListAPIView) and hasattr(View, 'model'):
|
||||
if type(View.model) is property:
|
||||
continue # special case for JobEventChildrenList
|
||||
views_by_model.setdefault(View.model, []).append(View)
|
||||
for model, views in views_by_model.items():
|
||||
creatable = False
|
||||
|
||||
Reference in New Issue
Block a user