-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_spp_indicator_studio.py
More file actions
55 lines (48 loc) · 2.44 KB
/
test_spp_indicator_studio.py
File metadata and controls
55 lines (48 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.
"""Install / view-load sanity tests for spp_indicator_studio.
This is a UI-bridge module — it ships act_window actions and form/list
views for ``spp.indicator`` and ``spp.indicator.category`` but no Python
models or methods of its own. The tests verify the install path and that
the headline view + action records loaded.
"""
from odoo.tests import TransactionCase, tagged
@tagged("post_install", "-at_install")
class TestSppIndicatorStudio(TransactionCase):
def test_module_is_installed(self):
module = self.env["ir.module.module"].search([("name", "=", "spp_indicator_studio")], limit=1)
self.assertTrue(module, "spp_indicator_studio not registered")
self.assertEqual(
module.state,
"installed",
f"spp_indicator_studio expected 'installed', got {module.state}",
)
def test_indicator_views_loaded(self):
"""views/indicator_views.xml declares list/form/kanban/action records."""
for xml_id in (
"spp_indicator_studio.spp_statistic_view_list",
"spp_indicator_studio.spp_statistic_view_form",
"spp_indicator_studio.spp_statistic_view_kanban",
"spp_indicator_studio.spp_statistic_action",
):
with self.subTest(record=xml_id):
self.assertTrue(
self.env.ref(xml_id, raise_if_not_found=False),
f"{xml_id} missing — indicator_views.xml didn't load",
)
def test_indicator_category_views_loaded(self):
"""views/indicator_category_views.xml declares list/form/action records."""
for xml_id in (
"spp_indicator_studio.spp_metric_category_view_list",
"spp_indicator_studio.spp_metric_category_view_form",
"spp_indicator_studio.spp_metric_category_action",
):
with self.subTest(record=xml_id):
self.assertTrue(
self.env.ref(xml_id, raise_if_not_found=False),
f"{xml_id} missing — indicator_category_views.xml didn't load",
)
def test_indicator_action_targets_spp_indicator(self):
"""The act_window must point at the spp.indicator model."""
action = self.env.ref("spp_indicator_studio.spp_statistic_action", raise_if_not_found=False)
self.assertTrue(action)
self.assertEqual(action.res_model, "spp.indicator")