You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 line
1.9 KiB

  1. import unittest
  2. from typing import List, Tuple
  3. from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report
  4. DEFAULT_FILTERS = {
  5. "company": "_Test Company",
  6. "from_date": "2010-01-01",
  7. "to_date": "2030-01-01",
  8. "period_start_date": "2010-01-01",
  9. "period_end_date": "2030-01-01",
  10. }
  11. REPORT_FILTER_TEST_CASES: List[Tuple[ReportName, ReportFilters]] = [
  12. ("General Ledger", {"group_by": "Group by Voucher (Consolidated)"}),
  13. ("General Ledger", {"group_by": "Group by Voucher (Consolidated)", "include_dimensions": 1}),
  14. ("Accounts Payable", {"range1": 30, "range2": 60, "range3": 90, "range4": 120}),
  15. ("Accounts Receivable", {"range1": 30, "range2": 60, "range3": 90, "range4": 120}),
  16. ("Consolidated Financial Statement", {"report": "Balance Sheet"}),
  17. ("Consolidated Financial Statement", {"report": "Profit and Loss Statement"}),
  18. ("Consolidated Financial Statement", {"report": "Cash Flow"}),
  19. ("Gross Profit", {"group_by": "Invoice"}),
  20. ("Gross Profit", {"group_by": "Item Code"}),
  21. ("Gross Profit", {"group_by": "Item Group"}),
  22. ("Gross Profit", {"group_by": "Customer"}),
  23. ("Gross Profit", {"group_by": "Customer Group"}),
  24. ("Item-wise Sales Register", {}),
  25. ("Item-wise Purchase Register", {}),
  26. ("Sales Register", {}),
  27. ("Sales Register", {"item_group": "All Item Groups"}),
  28. ("Purchase Register", {}),
  29. (
  30. "Tax Detail",
  31. {"mode": "run", "report_name": "Tax Detail"},
  32. ),
  33. ]
  34. OPTIONAL_FILTERS = {}
  35. class TestReports(unittest.TestCase):
  36. def test_execute_all_accounts_reports(self):
  37. """Test that all script report in stock modules are executable with supported filters"""
  38. for report, filter in REPORT_FILTER_TEST_CASES:
  39. with self.subTest(report=report):
  40. execute_script_report(
  41. report_name=report,
  42. module="Accounts",
  43. filters=filter,
  44. default_filters=DEFAULT_FILTERS,
  45. optional_filters=OPTIONAL_FILTERS if filter.get("_optional") else None,
  46. )