Skip to content

Commit

Permalink
Update result printer
Browse files Browse the repository at this point in the history
  • Loading branch information
Schwartz-Matthew-bah committed May 15, 2019
1 parent 12ae636 commit 87ce204
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions qa/test-harness/resultprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ class ValidationResultPrinter:
def __init__(self):
pass

def print(self, result, verbose):
def _create_summary_result(self, result):
error_list = []
for validation in result['Validations']:
if not validation['Valid']:
error_list.append("Field: %s, Details: %s" % (validation['Field']))
error_list.append("Field: %s, Details: %s" % (validation['Field'], validation['Details']))
printable_object = {
"Record": result['RecordID'],
"SerialID": json.dumps(result['Record']['metadata']['serialId']),
"SerialID": json.dumps(result['Record']['metadata']['serialId']) if result['RecordID'] != -1 else 'NA (SequentialCheck)',
"Errors": error_list,
}
if verbose:
if len(printable_object['Errors']) > 0:
print(yaml.dump(printable_object))
return printable_object

def print_list(self, result_object):
def print_list(self, result_object, errors_only, logger):
results_list = []
for result in result_object['Results']:
self.print(result, True)
result_summary = self._create_summary_result(result)
if not errors_only or len(result_summary['Errors']) > 0:
results_list.append(result_summary)
logger.info(yaml.dump(results_list))

0 comments on commit 87ce204

Please sign in to comment.