Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes tests that use AnsibleUndefined #383

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/test_ansibleundefined.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- Fixes test cases where there were assertion failure due to AnsibleUndefined path being changed.
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def test_ipaddr_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipaddr filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipaddr filter <value>",
):
_ipaddr(*args)

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def test_ipv4_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipv4 filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipv4 filter <value>",
):
_ipv4(*args)

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def test_ipv6_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipv6 filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipv6 filter <value>",
):
_ipv6(*args)

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/filter/test_ipwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def test_ipwrap_undefined_value(self):
args = ["", AnsibleUndefined(name="my_ip"), ""]
with pytest.raises(
AnsibleFilterError,
match="Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for ipwrap filter <value>",
# Note: this class has been moved to native_helpers dir since 2.16, hence adding regex to be backwards compatable with 2.15
match=r"Unrecognized type <<class 'ansible\.template\.(native_helpers\.)?AnsibleUndefined'>> for ipwrap filter <value>",
):
_ipwrap(*args)

Expand Down
Loading