diff options
author | Martin Krizek <martin.krizek@gmail.com> | 2020-04-17 14:59:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 14:59:52 +0200 |
commit | acdc9eb76d23e25ed8b1c7fc4fe8e4f9fd6f49fd (patch) | |
tree | cda65714c16fced51cfd93078e5751491032a209 /test | |
parent | 3591451bc75c3afcbc8ca1d6ff5e50d4bba2a876 (diff) | |
download | ansible-acdc9eb76d23e25ed8b1c7fc4fe8e4f9fd6f49fd.tar.gz |
native types: literal_eval all the things (#68938)
With https://github.com/pallets/jinja/pull/1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.
Diffstat (limited to 'test')
4 files changed, 4 insertions, 14 deletions
diff --git a/test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py b/test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py deleted file mode 100644 index 24c716c422..0000000000 --- a/test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py +++ /dev/null @@ -1,8 +0,0 @@ -from ansible.module_utils._text import to_text - - -class FilterModule(object): - def filters(self): - return { - 'to_text': to_text, - } diff --git a/test/integration/targets/jinja2_native_types/test_casting.yml b/test/integration/targets/jinja2_native_types/test_casting.yml index 5b4fe3ac0e..e66489ff5b 100644 --- a/test/integration/targets/jinja2_native_types/test_casting.yml +++ b/test/integration/targets/jinja2_native_types/test_casting.yml @@ -1,9 +1,9 @@ - name: cast things to other things set_fact: - int_to_str: "{{ i_two|to_text }}" + int_to_str: "'{{ i_two }}'" str_to_int: "{{ s_two|int }}" - dict_to_str: "{{ dict_one|to_text }}" - list_to_str: "{{ list_one|to_text }}" + dict_to_str: "'{{ dict_one }}'" + list_to_str: "'{{ list_one }}'" int_to_bool: "{{ i_one|bool }}" str_true_to_bool: "{{ s_true|bool }}" str_false_to_bool: "{{ s_false|bool }}" diff --git a/test/integration/targets/jinja2_native_types/test_concatentation.yml b/test/integration/targets/jinja2_native_types/test_concatentation.yml index 478182ab45..8a8077b669 100644 --- a/test/integration/targets/jinja2_native_types/test_concatentation.yml +++ b/test/integration/targets/jinja2_native_types/test_concatentation.yml @@ -18,7 +18,7 @@ - name: concatenate int and string set_fact: - string_sum: "{{ [(i_one|to_text), s_two]|join('') }}" + string_sum: "'{{ [i_one, s_two]|join('') }}'" - assert: that: diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 3031d2a9a4..7ab3628665 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -286,8 +286,6 @@ test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.1/DSCResources/AN test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.1/xTestDsc.psd1 pslint!skip test/integration/targets/incidental_win_ping/library/win_ping_syntax_error.ps1 pslint!skip test/integration/targets/incidental_win_reboot/templates/post_reboot.ps1 pslint!skip -test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py future-import-boilerplate -test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py metaclass-boilerplate test/integration/targets/lookup_ini/lookup-8859-15.ini no-smart-quotes test/integration/targets/module_precedence/lib_with_extension/ping.py future-import-boilerplate test/integration/targets/module_precedence/lib_with_extension/ping.py metaclass-boilerplate |