ansible/test/units/playbook
David Shrewsbury ff47d3f766
Make sure collection is a list if a str is given (#69081)
* Make sure collection is a list if a str is given

* Call field validation early on collections

Because we are doing work on modifying the collections value before
it is actually validated, we can validate it ourselves early to make
sure the user supplies either a string or list. Dicts are not valid.

The new validation allows us to simplify the _ensure_default_collection()
function. And since the field is now static, we no longer need to specify
a default for it, which also allows us to simplify the function. Since
the default is now removed, we can also remove the sanity/ignore.txt entry
for collectionsearch.py.

New unit tests are added (and the existing one modified) that allow us to
make sure that we throw a parser error if a user specifies something other
than a string or list for the collections value everywhere it can be specified.

* Revert removing the collection default

The default is actually used, so restore it.

* Fix unit tests in test_helpers.py affected by early collection validation
2020-04-28 10:47:11 -05:00
..
role Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
__init__.py
test_attribute.py
test_base.py Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
test_block.py Remove empty overridden unittest.setUp and unittest.tearDown methods. 2019-11-05 09:12:11 -08:00
test_collectionsearch.py Make sure collection is a list if a str is given (#69081) 2020-04-28 10:47:11 -05:00
test_conditional.py conditional: fix direct boolean "shortcut" (#47941) 2018-11-07 21:33:54 +01:00
test_helpers.py Make sure collection is a list if a str is given (#69081) 2020-04-28 10:47:11 -05:00
test_included_file.py Check if task file is specified for import_tasks (#57572) 2019-12-24 10:26:32 +05:30
test_play.py Remove empty overridden unittest.setUp and unittest.tearDown methods. 2019-11-05 09:12:11 -08:00
test_play_context.py Split test_play_context_make_become_cmd into files (#68026) 2020-03-04 22:26:04 -08:00
test_playbook.py Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
test_taggable.py Allow tags to be templated from a variable (#49833) 2018-12-17 15:40:26 -06:00
test_task.py Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00