Browse Source

Ensure we get a sorted list for validation groups

Change-Id: I3f905af3424fd25cd7dc71743ef8179cf4723bcd
changes/50/718350/2
Cédric Jeanneret 2 years ago
parent
commit
9158eb5b2b
  1. 2
      validations_libs/group.py
  2. 2
      validations_libs/tests/test_group.py
  3. 2
      validations_libs/tests/test_utils.py

2
validations_libs/group.py

@ -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())]

2
validations_libs/tests/test_group.py

@ -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)

2
validations_libs/tests/test_utils.py

@ -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])

Loading…
Cancel
Save