|
66 | 66 |
|
67 | 67 |
|
68 | 68 | class syntheticMaintPValidate: |
69 | | - def __init__(self, func, name, description): |
70 | | - self.function_name = func |
| 69 | + def __init__(self, name, description): |
71 | 70 | self.name = name |
72 | 71 | self.description = description |
73 | 72 | self.reason = "" |
74 | | - self.criticality = "critical" |
| 73 | + self.criticality = "informational" |
75 | 74 | self.passed = True |
76 | 75 | self.recommended_action = "" |
77 | 76 | self.sub_reason = "" |
78 | 77 | self.showValidation = True |
79 | | - self.failureDetails = self.initFailureDetails() |
80 | | - |
81 | | - def initFailureDetails(self): |
82 | | - failure_details = {} |
83 | | - failure_details["fail_type"] = "" |
84 | | - failure_details["header"] = "" |
85 | | - failure_details["footer"] = "" |
86 | | - failure_details["column"] = [] |
87 | | - failure_details["row"] = [] |
88 | | - return failure_details |
89 | | - |
90 | | - def updateWithResults(self, result, recommended_action, reason, header, footer, column, row): |
| 78 | + self.failureDetails = {} |
| 79 | + |
| 80 | + def updateWithResults(self, result, recommended_action, reason, header, footer, column, row, unformatted_column, unformatted_rows): |
91 | 81 | self.reason = reason |
92 | | - if result in [NA, PASS]: |
| 82 | + |
| 83 | + # Show validation |
| 84 | + if result in [NA, POST]: |
93 | 85 | self.showValidation = False |
94 | | - else: |
| 86 | + |
| 87 | + # Criticality |
| 88 | + if result in [FAIL_O, FAIL_UF]: |
| 89 | + self.criticality = "critical" |
| 90 | + elif result in [ERROR]: |
| 91 | + self.criticality = "major" |
| 92 | + elif result in [MANUAL]: |
| 93 | + self.criticality = "warning" |
| 94 | + |
| 95 | + # FailureDetails |
| 96 | + if result != PASS: |
95 | 97 | self.passed = False |
96 | 98 | self.recommended_action = recommended_action |
97 | 99 | self.failureDetails["fail_type"] = result |
98 | 100 | self.failureDetails["header"] = header |
99 | 101 | self.failureDetails["footer"] = footer |
100 | 102 | self.failureDetails["column"] = column |
101 | 103 | self.failureDetails["row"] = row |
| 104 | + self.failureDetails["unformatted_column"] = unformatted_column |
| 105 | + self.failureDetails["unformatted_rows"] = unformatted_rows |
102 | 106 |
|
103 | 107 | def buildResult(self): |
104 | 108 | result = { |
@@ -1095,12 +1099,19 @@ def print_result(title, result, msg='', |
1095 | 1099 | unformatted_headers=None, unformatted_data=None, |
1096 | 1100 | recommended_action='', |
1097 | 1101 | doc_url='', |
1098 | | - adjust_title=False, |
1099 | | - func="test"): |
1100 | | - synth = syntheticMaintPValidate(func, title, "") |
| 1102 | + adjust_title=False): |
| 1103 | + synth = syntheticMaintPValidate(title, "") |
1101 | 1104 | # TODO: deal with unformatted data and headers |
1102 | 1105 | synth.updateWithResults( |
1103 | | - result=result, recommended_action=recommended_action, reason=msg, header="", footer=doc_url, column=headers, row=data |
| 1106 | + result=result, |
| 1107 | + recommended_action=recommended_action, |
| 1108 | + reason=msg, |
| 1109 | + header="", |
| 1110 | + footer=doc_url, |
| 1111 | + column=headers, |
| 1112 | + row=data, |
| 1113 | + unformatted_column=unformatted_headers, |
| 1114 | + unformatted_rows=unformatted_data, |
1104 | 1115 | ) |
1105 | 1116 | synth.writeResult() |
1106 | 1117 | padding = 120 - len(title) - len(msg) |
|
0 commit comments