Skip to content

Commit

Permalink
Updated the tresult with info/err message
Browse files Browse the repository at this point in the history
  • Loading branch information
chidanandpujar committed Jun 6, 2024
1 parent 44f1bd5 commit 7257cf4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/jnpr/jsnapy/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ def _print_result(self, testmssg, result):
self.logger_testop.info(
colorama.Fore.GREEN + "PASS | " + testmssg, extra=self.log_detail
)
def _print_mssg(self, testmssg, result):
if result is False:
self.logger_testop.info(
colorama.Fore.RED + "FAIL | " + testmssg, extra=self.log_detail
)
elif result is True:
self.logger_testop.info(
colorama.Fore.GREEN + "PASS | " + testmssg, extra=self.log_detail
)

def print_testmssg(self, testname):
"""
Expand Down Expand Up @@ -420,7 +429,7 @@ def exists(
% (element, x_path, count_pass, count_fail)
)
self._print_result(msg, res)
self._print_result(err_mssg, res)
self._print_mssg(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 ]' % (
Expand All @@ -429,7 +438,7 @@ def exists(
count_pass,
)
self._print_result(msg, res)
self._print_result(info_mssg, res)
self._print_mssg(info_mssg, res)
tresult["info"] = info_mssg # Updating the user specified info message

# tresult['info'] = info_mssg
Expand Down

0 comments on commit 7257cf4

Please sign in to comment.