Ensure we get a sorted list for validation groups

Change-Id: I3f905af3424fd25cd7dc71743ef8179cf4723bcd
This commit is contained in:
Cédric Jeanneret 2020-04-08 11:02:28 +02:00
parent c940a0c30d
commit 9158eb5b2b
3 changed files with 3 additions and 3 deletions

View File

@ -42,4 +42,4 @@ class Group(object):
@property
def get_groups_keys_list(self):
return [gp for gp in self.data.keys()]
return [gp for gp in sorted(self.data.keys())]

View File

@ -47,7 +47,7 @@ class TestGroup(TestCase):
@mock.patch('six.moves.builtins.open')
def test_get_groups_keys_list(self, mock_open, mock_yaml):
grp = Group('/tmp/foo')
ret = ['no-op', 'pre', 'post']
ret = ['no-op', 'post', 'pre']
data = grp.get_groups_keys_list
self.assertEquals(data, ret)

View File

@ -118,7 +118,7 @@ class TestUtils(TestCase):
def test_get_validation_group_name_list(self, mock_open, mock_load):
result = utils.get_validation_group_name_list('/foo/groups.yaml')
self.assertEqual(result, ['no-op', 'pre', 'post'])
self.assertEqual(result, ['no-op', 'post', 'pre'])
@mock.patch('validations_libs.utils.parse_all_validations_on_disk',
return_value=[fakes.FAKE_METADATA])