test: account reports

This commit is contained in:
Ankush Menat
2022-01-09 19:23:27 +05:30
committed by Ankush Menat
parent 2d76c05175
commit f195f803ff
2 changed files with 58 additions and 4 deletions

View File

@@ -125,17 +125,23 @@ def execute_script_report(
if default_filters is None:
default_filters = {}
test_filters = []
report_execute_fn = frappe.get_attr(get_report_module_dotted_path(module, report_name) + ".execute")
report_filters = frappe._dict(default_filters).copy().update(filters)
report_data = report_execute_fn(report_filters)
test_filters.append(report_filters)
if optional_filters:
for key, value in optional_filters.items():
filter_with_optional_param = report_filters.copy().update({key: value})
report_execute_fn(filter_with_optional_param)
test_filters.append(report_filters.copy().update({key: value}))
for test_filter in test_filters:
try:
report_execute_fn(test_filter)
except Exception:
print(f"Report failed to execute with filters: {test_filter}")
raise
return report_data
def timeout(seconds=30, error_message="Test timed out."):