Make sure the expected codes list is sorted
Previously the HTTP expected codes was using a set data type. This patch changes the set to a sorted list to allow for consistent testing and to make sure our expected codes list is always nicely sorted. Change-Id: Id53c2552221bb133d69193f60516c6a785b8c7f7
This commit is contained in:
parent
7736eead78
commit
811ec10f32
@ -457,4 +457,4 @@ class JinjaTemplater(object):
|
||||
str(i) for i in six.moves.xrange(int(low), int(hi) + 1))
|
||||
else:
|
||||
retval.add(code)
|
||||
return retval
|
||||
return sorted(retval)
|
||||
|
@ -960,31 +960,31 @@ class TestHaproxyCfg(base.TestCase):
|
||||
def test_expand_expected_codes(self):
|
||||
exp_codes = ''
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set([]))
|
||||
[])
|
||||
exp_codes = '200'
|
||||
self.assertEqual(
|
||||
self.jinja_cfg._expand_expected_codes(exp_codes), set(['200']))
|
||||
self.jinja_cfg._expand_expected_codes(exp_codes), ['200'])
|
||||
exp_codes = '200, 201'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201']))
|
||||
['200', '201'])
|
||||
exp_codes = '200, 201,202'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
['200', '201', '202'])
|
||||
exp_codes = '200-202'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
['200', '201', '202'])
|
||||
exp_codes = '200-202, 205'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '205']))
|
||||
['200', '201', '202', '205'])
|
||||
exp_codes = '200, 201-203'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203']))
|
||||
['200', '201', '202', '203'])
|
||||
exp_codes = '200, 201-203, 205'
|
||||
self.assertEqual(self.jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203', '205']))
|
||||
['200', '201', '202', '203', '205'])
|
||||
exp_codes = '201-200, 205'
|
||||
self.assertEqual(
|
||||
self.jinja_cfg._expand_expected_codes(exp_codes), set(['205']))
|
||||
self.jinja_cfg._expand_expected_codes(exp_codes), ['205'])
|
||||
|
||||
def test_render_template_no_log(self):
|
||||
j_cfg = jinja_cfg.JinjaTemplater(
|
||||
|
Loading…
x
Reference in New Issue
Block a user