mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 18:31:25 -07:00
[PR #9179/a3bd49c0 backport][stable-10] deps module utils: unit tests + minor improvement (#9182)
deps module utils: unit tests + minor improvement (#9179)
* deps module utils: unit tests + minor improvement
* deps.clear() calls dict.clear() instead of creating new dict
* add changelog frag
(cherry picked from commit a3bd49c010
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
5fe39082d5
commit
0b64fc1ee4
5 changed files with 81 additions and 1 deletions
|
@ -14,6 +14,7 @@ from ansible_collections.community.general.plugins.module_utils.module_helper im
|
|||
)
|
||||
|
||||
|
||||
# remove in 11.0.0
|
||||
def test_dependency_ctxmgr():
|
||||
ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed")
|
||||
with ctx:
|
||||
|
@ -36,6 +37,7 @@ def test_dependency_ctxmgr():
|
|||
assert ctx.has_it
|
||||
|
||||
|
||||
# remove in 11.0.0
|
||||
def test_variable_meta():
|
||||
meta = VarMeta()
|
||||
assert meta.output is True
|
||||
|
@ -51,6 +53,7 @@ def test_variable_meta():
|
|||
assert meta.diff_result is None
|
||||
|
||||
|
||||
# remove in 11.0.0
|
||||
def test_variable_meta_diff():
|
||||
meta = VarMeta(diff=True)
|
||||
assert meta.output is True
|
||||
|
@ -70,6 +73,7 @@ def test_variable_meta_diff():
|
|||
assert meta.diff_result == {"before": "abc", "after": "ghi"}
|
||||
|
||||
|
||||
# remove in 11.0.0
|
||||
def test_vardict():
|
||||
vd = VarDict()
|
||||
vd.set('a', 123)
|
||||
|
@ -99,6 +103,7 @@ def test_vardict():
|
|||
assert vd.diff() == {'before': {'a': 123}, 'after': {'a': 'new_a'}}, "diff={0}".format(vd.diff())
|
||||
|
||||
|
||||
# remove in 11.0.0
|
||||
def test_variable_meta_change():
|
||||
vd = VarDict()
|
||||
vd.set('a', 123, change=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue