Allow to sort 'all' by 'type_name'

Change-Id: Iced8a08e1e3a9a1aa296a77d7c6259faf3fd1f95
This commit is contained in:
Mike Fedosin 2017-12-12 12:59:52 +01:00 committed by Kushal Agrawal
parent 2924e662cb
commit 8d4806fc8d
3 changed files with 9 additions and 1 deletions

View File

@ -28,7 +28,8 @@ class All(base.BaseArtifact):
fields = {
'type_name': Field(fields.StringField,
description="Name of artifact type."),
description="Name of artifact type.",
sortable=True),
}
@classmethod

View File

@ -55,6 +55,12 @@ class TestAll(base.TestArtifact):
for art in res:
self.assertIn(art['type_name'], ('images', 'heat_templates'))
# get all artifacts sorted by type_name
url = '/all?sort=type_name:asc&limit=100'
res = self.get(url=url, status=200)['artifacts']
self.assertEqual(54, len(res))
self.assertEqual(sorted(res, key=lambda x: x['type_name']), res)
def test_all_readonlyness(self):
self.create_artifact(data={'name': 'all'}, type_name='all', status=403)
art = self.create_artifact(data={'name': 'image'}, type_name='images')

View File

@ -929,6 +929,7 @@ fixtures = {
u'filter_ops': [u'eq', u'neq', u'in'],
u'glareType': u'String',
u'maxLength': 255,
u'sortable': True,
u'type': [u'string', u'null']},
}),