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

Issue 393 fix1 #415

Merged
merged 13 commits into from
Jul 19, 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
15 changes: 14 additions & 1 deletion lib/jnpr/jsnapy/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def testname_results(self):
test["command"] = cmd
testname_result_dict.setdefault(test["test_name"], [])
testname_result_dict[test["test_name"]].append(test)
del test["test_name"]
return testname_result_dict

def define_operator(
Expand Down Expand Up @@ -118,6 +117,16 @@ def _print_result(self, testmssg, result):
colorama.Fore.GREEN + "PASS | " + testmssg, extra=self.log_detail
)

def _print_msg(self, testmssg, result):
if result is False:
self.logger_testop.info(
colorama.Fore.RED + "FAIL | " + testmssg, extra=self.log_detail
)
else:
self.logger_testop.info(
colorama.Fore.GREEN + "PASS | " + testmssg, extra=self.log_detail
)

def print_testmssg(self, testname):
"""
Print info and error messages
Expand Down Expand Up @@ -420,13 +429,17 @@ def exists(
% (element, x_path, count_pass, count_fail)
)
self._print_result(msg, res)
self._print_msg(err_mssg, res)
tresult["err"] = err_mssg # Updating the user specified err message
elif res is True:
msg = 'All "%s" exists at xpath "%s" [ %d value matched ]' % (
element,
x_path,
count_pass,
)
self._print_result(msg, res)
self._print_msg(info_mssg, res)
tresult["info"] = info_mssg # Updating the user specified info message

# tresult['info'] = info_mssg
# tresult['err'] = err_mssg
Expand Down
4 changes: 2 additions & 2 deletions tools/jsnap2py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def msg_change(x):
data = (data[0],data[1][1:])
if data[0] in ['id', 'ID']:
data = (data[0], int(data[1])-1)
msg = "{{%s_%s}}" % (data)
msg = "{{%s_%s}}" % (data)
elif data[0] in ['PRE', 'POST']:
msg = '{{%s["%s"]}}' % (data)
else:
Expand Down Expand Up @@ -120,7 +120,7 @@ else:
'\$id\.\d|\$pre\s?/?\.?/\s?[\w-]+/?[\w-]*|\$post\s?/?\.?/\s?[\w-]+/?[\w-]*|,\s?\.{0,2}/?\.{0,2}/?[\w-]+/?[\w-]*/?[\w-]*',
data.group(2),
re.I)
inputs = map(msg_change, inputs)
inputs = list(map(msg_change, inputs))
to_format = re.search('"(.*?)"', obj.group(2))
if len(inputs) > 0:
if to_format:
Expand Down
Loading