Files
odoo_source/addons/spreadsheet_dashboard/tests/test_dashboard_data.py
T
Lucas Lefèvre d72fa35ced [IMP] spreadsheet_dashboard: use py test to validate dashboard data
use a python test to walk throuhg jsons instead of tours

Tours:
- you need to add one for each dashboard. It's a PITA and it doesn't scale
- they only check visible formulas since formulas are loaded only if they are in the viewport (I'm not even sure what is "visible" in chrome headless)
- they are slow
- can't check fields defined in global filters, links to odoo menu/views

`./odoo-bin --addons-path=../enterprise,./addons  -d odoo-db -u  --test-enable`

before: `59,76s user 5,78s system 29% cpu 3:43,15 total`
after: `15,12s user 1,20s system 86% cpu 18,912 total`

The Expenses dashboard was broken by https://github.com/odoo/odoo/pull/98914
But I want to merge this test right now.

Task 2980180

closes odoo/odoo#100757

X-original-commit: 17afe2987e4146b85187b31a34caf7146d5a7cf2
Related: odoo/enterprise#31598
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2022-09-21 21:41:48 +02:00

22 lines
941 B
Python

from odoo.addons.spreadsheet.tests.validate_spreadsheet_data import (
ValidateSpreadsheetData,
)
from odoo.tests.common import tagged
@tagged("-at_install", "post_install")
class TestSpreadsheetDashboardData(ValidateSpreadsheetData):
def test_validate_dashboard_data(self):
"""validate fields and models used in dashboards"""
dashboards = self.env["spreadsheet.dashboard"].search([])
for dashboard in dashboards:
# this dashboard is skipped because it's currently broken
# but I still want to merge this test right now to avoid other broken dashboards
if dashboard == self.env.ref(
"spreadsheet_dashboard_hr_expense.spreadsheet_dashboard_expense",
raise_if_not_found=False,
):
continue
with self.subTest(dashboard.name):
self.validate_spreadsheet_data(dashboard.raw, dashboard.name)