update tests
parent
4f4db18d41
commit
1ce17fab54
|
@ -1216,6 +1216,10 @@ from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_valid
|
||||||
AnsibleArgSpecValidator,
|
AnsibleArgSpecValidator,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# import debugpy
|
||||||
|
|
||||||
|
# debugpy.listen(3000)
|
||||||
|
# debugpy.wait_for_client()
|
||||||
try:
|
try:
|
||||||
from jinja2.filters import pass_environment
|
from jinja2.filters import pass_environment
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -160,9 +160,9 @@ def consolidate_facts(data_sources, all_values):
|
||||||
|
|
||||||
def consolidate(
|
def consolidate(
|
||||||
data_sources,
|
data_sources,
|
||||||
fail_missing_match_key=False,
|
fail_missing_match_key,
|
||||||
fail_missing_match_value=False,
|
fail_missing_match_value,
|
||||||
fail_duplicate=False,
|
fail_duplicate,
|
||||||
):
|
):
|
||||||
"""Calls data validation and consolidation functions
|
"""Calls data validation and consolidation functions
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,16 @@ class TestConsolidate(unittest.TestCase):
|
||||||
"l3_interfaces": {"name": "Loopback999"},
|
"l3_interfaces": {"name": "Loopback999"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
args = ["", data_sources]
|
fail_missing_match_value = False
|
||||||
|
fail_missing_match_key = False
|
||||||
|
fail_duplicate = False
|
||||||
|
args = [
|
||||||
|
"",
|
||||||
|
data_sources,
|
||||||
|
fail_missing_match_key,
|
||||||
|
fail_missing_match_value,
|
||||||
|
fail_duplicate,
|
||||||
|
]
|
||||||
|
|
||||||
result = _consolidate(*args)
|
result = _consolidate(*args)
|
||||||
self.assertEqual(result, output)
|
self.assertEqual(result, output)
|
||||||
|
@ -366,7 +375,7 @@ class TestConsolidate(unittest.TestCase):
|
||||||
]
|
]
|
||||||
|
|
||||||
fail_missing_match_key = True
|
fail_missing_match_key = True
|
||||||
args = ["", data_sources, fail_missing_match_key]
|
args = ["", data_sources, fail_missing_match_key, False, False]
|
||||||
with self.assertRaises(AnsibleFilterError) as error:
|
with self.assertRaises(AnsibleFilterError) as error:
|
||||||
_consolidate(*args)
|
_consolidate(*args)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
|
@ -374,7 +383,7 @@ class TestConsolidate(unittest.TestCase):
|
||||||
str(error.exception),
|
str(error.exception),
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_fail_missing_match_value(self):
|
def test_fail_duplicate(self):
|
||||||
data_sources = [
|
data_sources = [
|
||||||
{
|
{
|
||||||
"data": [
|
"data": [
|
||||||
|
|
Loading…
Reference in New Issue