mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 14:09:28 -02:30
Merge pull request #1649 from chrismeyersfsu/fix-label_alpha
order tags alphabetically
This commit is contained in:
@@ -1624,7 +1624,7 @@ class JobOptionsSerializer(BaseSerializer):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def _summary_field_labels(self, obj):
|
def _summary_field_labels(self, obj):
|
||||||
return [{'id': x.id, 'name': x.name} for x in obj.labels.all().order_by('-name')[:10]]
|
return [{'id': x.id, 'name': x.name} for x in obj.labels.all().order_by('name')[:10]]
|
||||||
|
|
||||||
def get_summary_fields(self, obj):
|
def get_summary_fields(self, obj):
|
||||||
res = super(JobOptionsSerializer, self).get_summary_fields(obj)
|
res = super(JobOptionsSerializer, self).get_summary_fields(obj)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class TestJobOptionsSerializerGetSummaryFields(GetSummaryFieldsMixin):
|
|||||||
serializer = JobOptionsSerializer()
|
serializer = JobOptionsSerializer()
|
||||||
summary_labels = serializer._summary_field_labels(job_template)
|
summary_labels = serializer._summary_field_labels(job_template)
|
||||||
|
|
||||||
job_template.labels.all.order_by.assert_called_with('-name')
|
job_template.labels.all.order_by.assert_called_with('name')
|
||||||
assert len(summary_labels) == 10
|
assert len(summary_labels) == 10
|
||||||
assert summary_labels == [{'id': x.id, 'name': x.name} for x in labels[:10]]
|
assert summary_labels == [{'id': x.id, 'name': x.name} for x in labels[:10]]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user