Fix with_ini example and unittest

* Fix example in ini.py
* Fix unittest in test_ini.py to pass CI as latest ansible returns list in
  different order. To prevent such issues in future results are sorted
* PEP8 E501 styling improvements

Co-Authored-By: Sergii Golovatiuk <sgolovat@redhat.com>
This commit is contained in:
Yannig Perré 2017-12-30 18:21:24 +01:00 committed by Toshio Kuratomi
parent 1e4ab5a038
commit 6b41588e93
2 changed files with 16 additions and 14 deletions

View file

@ -31,27 +31,27 @@ class TestINILookup(unittest.TestCase):
# Simple case
dict(
term=u'keyA section=sectionA file=/path/to/file',
expected=[u'keyA', u'section=sectionA', u'file=/path/to/file'],
expected=[u'file=/path/to/file', u'keyA', u'section=sectionA'],
),
dict(
term=u'keyB section=sectionB with space file=/path/with/embedded spaces and/file',
expected=[u'keyB', u'section=sectionB with space', u'file=/path/with/embedded spaces and/file'],
expected=[u'file=/path/with/embedded spaces and/file', u'keyB', u'section=sectionB with space'],
),
dict(
term=u'keyC section=sectionC file=/path/with/equals/cn=com.ansible',
expected=[u'keyC', u'section=sectionC', u'file=/path/with/equals/cn=com.ansible'],
expected=[u'file=/path/with/equals/cn=com.ansible', u'keyC', u'section=sectionC'],
),
dict(
term=u'keyD section=sectionD file=/path/with space and/equals/cn=com.ansible',
expected=[u'keyD', u'section=sectionD', u'file=/path/with space and/equals/cn=com.ansible'],
expected=[u'file=/path/with space and/equals/cn=com.ansible', u'keyD', u'section=sectionD'],
),
dict(
term=u'keyE section=sectionE file=/path/with/unicode/くらとみ/file',
expected=[u'keyE', u'section=sectionE', u'file=/path/with/unicode/くらとみ/file'],
expected=[u'file=/path/with/unicode/くらとみ/file', u'keyE', u'section=sectionE'],
),
dict(
term=u'keyF section=sectionF file=/path/with/utf 8 and spaces/くらとみ/file',
expected=[u'keyF', u'section=sectionF', u'file=/path/with/utf 8 and spaces/くらとみ/file'],
expected=[u'file=/path/with/utf 8 and spaces/くらとみ/file', u'keyF', u'section=sectionF'],
),
)
@ -65,4 +65,5 @@ class TestINILookup(unittest.TestCase):
for testcase in self.old_style_params_data:
# print(testcase)
params = _parse_params(testcase['term'])
params.sort()
self.assertEqual(params, testcase['expected'])