Skip to content

Commit

Permalink
Merge pull request #414 from chidanandpujar/issue_413_fix1
Browse files Browse the repository at this point in the history
Fix no_diff with missing pre and post snapfile
  • Loading branch information
dineshbaburam91 authored Jul 17, 2024
2 parents 5198af3 + 28e0b6e commit f1a5e70
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/jnpr/jsnapy/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ def not_exists(
count_pass = count_pass + 1
node_value_passed = {
"id": id_val,
"PRE": predict,
"POST": postdict,
"pre": predict,
"post": postdict,
"message": message,
}
tresult["passed"].append(deepcopy(node_value_passed))
Expand Down Expand Up @@ -2739,6 +2739,18 @@ def no_diff(
+ "ERROR!! 'no-diff' operator requires node value to test !!",
extra=self.log_detail,
)
elif xml1 is None or xml2 is None:
self._error_nodes_logger("Xpath for snapshot", x_path)
res = False
count_fail = count_fail + 1
node_value_failed = {
"id": iddict,
"pre": predict,
"post": postdict,
"actual_node_value": None,
"xpath_error": True,
}
tresult["failed"].append(deepcopy(node_value_failed))
else:
if (not pre_nodes) or (not post_nodes):
# if ignore_null is True, just skip
Expand Down Expand Up @@ -2873,7 +2885,8 @@ def no_diff(
else:
# mapping id name to its value
for length in range(len(k)):
id_val[id_list[length]] = k[length][0].strip()
if len(k[0]) > 0:
id_val[id_list[length]] = k[length][0].strip()
if k in data1:
predict, postdict = self._get_nodevalue(
predict,
Expand Down

0 comments on commit f1a5e70

Please sign in to comment.