Skip to content

Commit 4db305c

Browse files
fix: update test_coverage files to use renamed model and class names
Tests added on 19.0 referenced old module/model names (spp.aggregation.*, spp.metrics.*, AggregationTestCase) that were renamed in this branch. Also removes tests for validate_access_level/get_k_threshold methods that no longer exist after the privacy service refactor.
1 parent 03e1d35 commit 4db305c

8 files changed

Lines changed: 101 additions & 151 deletions

File tree

spp_analytics/README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
==========================
2-
OpenSPP Aggregation Engine
3-
==========================
1+
=================
2+
OpenSPP Analytics
3+
=================
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -17,7 +17,7 @@ OpenSPP Aggregation Engine
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
20-
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_aggregation
20+
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_analytics
2121
:alt: OpenSPP/OpenSPP2
2222

2323
|badge1| |badge2| |badge3|
@@ -121,7 +121,7 @@ Bug Tracker
121121
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
122122
In case of trouble, please check there if your issue has already been reported.
123123
If you spotted it first, help us to smash it by providing a detailed and welcomed
124-
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_aggregation%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
124+
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_analytics%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
125125

126126
Do not contact contributors directly about support or help with technical issues.
127127

@@ -144,6 +144,6 @@ Current maintainer:
144144

145145
|maintainer-jeremi|
146146

147-
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_aggregation>`_ project on GitHub.
147+
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_analytics>`_ project on GitHub.
148148

149149
You are welcome to contribute.

spp_analytics/tests/test_coverage.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.
2-
"""Extended coverage tests for spp_aggregation module.
2+
"""Extended coverage tests for spp_analytics module.
33
44
Covers edge cases in access rules, cache key generation,
55
scope resolver, and aggregation service convenience methods.
@@ -10,17 +10,17 @@
1010
from odoo.exceptions import ValidationError
1111
from odoo.tests import tagged
1212

13-
from .common import AggregationTestCase
13+
from .common import AnalyticsTestCase
1414

1515

1616
@tagged("post_install", "-at_install")
17-
class TestAccessRuleValidation(AggregationTestCase):
18-
"""Tests for spp.aggregation.access.rule constraint and validation edge cases."""
17+
class TestAccessRuleValidation(AnalyticsTestCase):
18+
"""Tests for spp.analytics.access.rule constraint and validation edge cases."""
1919

2020
def test_constraint_both_user_and_group_raises(self):
2121
"""Setting both user_id and group_id must raise ValidationError."""
2222
with self.assertRaises(ValidationError):
23-
self.env["spp.aggregation.access.rule"].create(
23+
self.env["spp.analytics.access.rule"].create(
2424
{
2525
"name": "Invalid Rule",
2626
"access_level": "aggregate",
@@ -38,7 +38,7 @@ def test_constraint_neither_user_nor_group_raises(self):
3838
def test_constraint_k_anonymity_below_1_raises(self):
3939
"""minimum_k_anonymity < 1 must raise ValidationError."""
4040
with self.assertRaises(ValidationError):
41-
self.env["spp.aggregation.access.rule"].create(
41+
self.env["spp.analytics.access.rule"].create(
4242
{
4343
"name": "K Too Low",
4444
"access_level": "aggregate",
@@ -50,7 +50,7 @@ def test_constraint_k_anonymity_below_1_raises(self):
5050
def test_constraint_k_anonymity_above_100_raises(self):
5151
"""minimum_k_anonymity > 100 must raise ValidationError."""
5252
with self.assertRaises(ValidationError):
53-
self.env["spp.aggregation.access.rule"].create(
53+
self.env["spp.analytics.access.rule"].create(
5454
{
5555
"name": "K Too High",
5656
"access_level": "aggregate",
@@ -62,7 +62,7 @@ def test_constraint_k_anonymity_above_100_raises(self):
6262
def test_constraint_max_dimensions_negative_raises(self):
6363
"""max_group_by_dimensions < 0 must raise ValidationError."""
6464
with self.assertRaises(ValidationError):
65-
self.env["spp.aggregation.access.rule"].create(
65+
self.env["spp.analytics.access.rule"].create(
6666
{
6767
"name": "Negative Dims",
6868
"access_level": "aggregate",
@@ -74,7 +74,7 @@ def test_constraint_max_dimensions_negative_raises(self):
7474
def test_constraint_max_dimensions_above_10_raises(self):
7575
"""max_group_by_dimensions > 10 must raise ValidationError."""
7676
with self.assertRaises(ValidationError):
77-
self.env["spp.aggregation.access.rule"].create(
77+
self.env["spp.analytics.access.rule"].create(
7878
{
7979
"name": "Too Many Dims",
8080
"access_level": "aggregate",
@@ -216,7 +216,7 @@ def test_get_effective_rule_user_over_group(self):
216216
}
217217
)
218218
# Create group-based rule
219-
self.env["spp.aggregation.access.rule"].create(
219+
self.env["spp.analytics.access.rule"].create(
220220
{
221221
"name": "Group Rule",
222222
"access_level": "aggregate",
@@ -226,7 +226,7 @@ def test_get_effective_rule_user_over_group(self):
226226
}
227227
)
228228
# Create user-specific rule
229-
user_rule = self.env["spp.aggregation.access.rule"].create(
229+
user_rule = self.env["spp.analytics.access.rule"].create(
230230
{
231231
"name": "User Rule",
232232
"access_level": "individual",
@@ -236,20 +236,20 @@ def test_get_effective_rule_user_over_group(self):
236236
}
237237
)
238238
# User-specific rule should win regardless of sequence
239-
AccessRule = self.env["spp.aggregation.access.rule"]
239+
AccessRule = self.env["spp.analytics.access.rule"]
240240
effective = AccessRule.get_effective_rule_for_user(test_user)
241241
self.assertEqual(effective.id, user_rule.id)
242242
self.assertEqual(effective.access_level, "individual")
243243

244244

245245
@tagged("post_install", "-at_install")
246-
class TestCacheServiceKeyGeneration(AggregationTestCase):
246+
class TestCacheServiceKeyGeneration(AnalyticsTestCase):
247247
"""Tests for cache key generation across all scope types."""
248248

249249
@classmethod
250250
def setUpClass(cls):
251251
super().setUpClass()
252-
cls.cache_service = cls.env["spp.aggregation.cache"]
252+
cls.cache_service = cls.env["spp.analytics.cache"]
253253

254254
def test_scope_key_parts_dict_area(self):
255255
"""Cache key parts for dict area scope must include area_id and children flag."""
@@ -336,27 +336,27 @@ def test_get_ttl_for_scope_type(self):
336336

337337
def test_cron_cleanup_expired(self):
338338
"""cron_cleanup_expired on cache.entry must delegate to cache service."""
339-
cache_entry_model = self.env["spp.aggregation.cache.entry"]
339+
cache_entry_model = self.env["spp.analytics.cache.entry"]
340340
# Should run without error and return an integer
341341
result = cache_entry_model.cron_cleanup_expired()
342342
self.assertIsInstance(result, int)
343343

344344
def test_store_result_serialization_error(self):
345345
"""store_result must return False when result cannot be serialized."""
346346
scope = self.create_scope("area", area_id=self.area_region.id)
347-
with patch("odoo.addons.spp_aggregation.models.service_cache.json.dumps", side_effect=TypeError("bad")):
347+
with patch("odoo.addons.spp_analytics.models.service_cache.json.dumps", side_effect=TypeError("bad")):
348348
stored = self.cache_service.store_result(scope, ["count"], [], {"total": 1})
349349
self.assertFalse(stored)
350350

351351

352352
@tagged("post_install", "-at_install")
353-
class TestScopeResolverEdgeCases(AggregationTestCase):
353+
class TestScopeResolverEdgeCases(AnalyticsTestCase):
354354
"""Tests for scope resolver edge cases and error handling."""
355355

356356
@classmethod
357357
def setUpClass(cls):
358358
super().setUpClass()
359-
cls.resolver = cls.env["spp.aggregation.scope.resolver"]
359+
cls.resolver = cls.env["spp.analytics.scope.resolver"]
360360

361361
def test_resolve_inline_missing_scope_type(self):
362362
"""Inline scope dict without scope_type must return empty list."""
@@ -403,13 +403,13 @@ def test_resolve_intersect_empty_scopes(self):
403403

404404

405405
@tagged("post_install", "-at_install")
406-
class TestAggregationServiceExtended(AggregationTestCase):
407-
"""Extended tests for spp.aggregation.service convenience methods and scope resolution."""
406+
class TestAggregationServiceExtended(AnalyticsTestCase):
407+
"""Extended tests for spp.analytics.service convenience methods and scope resolution."""
408408

409409
@classmethod
410410
def setUpClass(cls):
411411
super().setUpClass()
412-
cls.service = cls.env["spp.aggregation.service"]
412+
cls.service = cls.env["spp.analytics.service"]
413413

414414
def test_resolve_scope_dict(self):
415415
"""_resolve_scope with dict must return the same dict."""
@@ -422,7 +422,7 @@ def test_resolve_scope_int(self):
422422
scope = self.create_scope("area", area_id=self.area_region.id)
423423
result = self.service._resolve_scope(scope.id)
424424
self.assertEqual(result.id, scope.id)
425-
self.assertEqual(result._name, "spp.aggregation.scope")
425+
self.assertEqual(result._name, "spp.analytics.scope")
426426

427427
def test_resolve_scope_record(self):
428428
"""_resolve_scope with record must return the same record."""

spp_api_v2_simulation/README.rst

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,41 @@ Key Capabilities
4242
API Endpoints
4343
~~~~~~~~~~~~~
4444

45-
+--------+-----------------------------+-----------------------------+
46-
| Method | Path | Description |
47-
+========+=============================+=============================+
48-
| GET | ``/simulation/scenarios`` | List scenarios |
49-
+--------+-----------------------------+-----------------------------+
50-
| POST | ``/simulation/scenarios`` | Create scenario |
51-
+--------+-----------------------------+-----------------------------+
52-
| GET | ``/ | Get scenario details |
53-
| | simulation/scenarios/{id}`` | |
54-
+--------+-----------------------------+-----------------------------+
55-
| PUT | ``/ | Update draft scenario |
56-
| | simulation/scenarios/{id}`` | |
57-
+--------+-----------------------------+-----------------------------+
58-
| DELETE | ``/ | Archive scenario |
59-
| | simulation/scenarios/{id}`` | |
60-
+--------+-----------------------------+-----------------------------+
61-
| POST | ``/simula | Mark scenario ready |
62-
| | tion/scenarios/{id}/ready`` | |
63-
+--------+-----------------------------+-----------------------------+
64-
| POST | ``/simu | Execute simulation |
65-
| | lation/scenarios/{id}/run`` | |
66-
+--------+-----------------------------+-----------------------------+
67-
| POST | ``/simulation/scenario | Convert to program |
68-
| | s/{id}/convert-to-program`` | |
69-
+--------+-----------------------------+-----------------------------+
70-
| GET | ``/simulation/runs`` | List runs |
71-
+--------+-----------------------------+-----------------------------+
72-
| GET | ``/simulation/runs/{id}`` | Get run with optional |
73-
| | | details |
74-
+--------+-----------------------------+-----------------------------+
75-
| POST | ``/simulation/comparisons`` | Create run comparison |
76-
+--------+-----------------------------+-----------------------------+
77-
| GET | ``/si | Get comparison |
78-
| | mulation/comparisons/{id}`` | |
79-
+--------+-----------------------------+-----------------------------+
80-
| GET | ``/simulation/templates`` | List scenario templates |
81-
+--------+-----------------------------+-----------------------------+
82-
| POST | ``/aggregation/compute`` | Compute population |
83-
| | | aggregation |
84-
+--------+-----------------------------+-----------------------------+
85-
| GET | ``/aggregation/dimensions`` | List demographic dimensions |
86-
+--------+-----------------------------+-----------------------------+
45+
+--------+---------------------------------------------------+------------------------------+
46+
| Method | Path | Description |
47+
+========+===================================================+==============================+
48+
| GET | ``/simulation/scenarios`` | List scenarios |
49+
+--------+---------------------------------------------------+------------------------------+
50+
| POST | ``/simulation/scenarios`` | Create scenario |
51+
+--------+---------------------------------------------------+------------------------------+
52+
| GET | ``/simulation/scenarios/{id}`` | Get scenario details |
53+
+--------+---------------------------------------------------+------------------------------+
54+
| PUT | ``/simulation/scenarios/{id}`` | Update draft scenario |
55+
+--------+---------------------------------------------------+------------------------------+
56+
| DELETE | ``/simulation/scenarios/{id}`` | Archive scenario |
57+
+--------+---------------------------------------------------+------------------------------+
58+
| POST | ``/simulation/scenarios/{id}/ready`` | Mark scenario ready |
59+
+--------+---------------------------------------------------+------------------------------+
60+
| POST | ``/simulation/scenarios/{id}/run`` | Execute simulation |
61+
+--------+---------------------------------------------------+------------------------------+
62+
| POST | ``/simulation/scenarios/{id}/convert-to-program`` | Convert to program |
63+
+--------+---------------------------------------------------+------------------------------+
64+
| GET | ``/simulation/runs`` | List runs |
65+
+--------+---------------------------------------------------+------------------------------+
66+
| GET | ``/simulation/runs/{id}`` | Get run with optional |
67+
| | | details |
68+
+--------+---------------------------------------------------+------------------------------+
69+
| POST | ``/simulation/comparisons`` | Create run comparison |
70+
+--------+---------------------------------------------------+------------------------------+
71+
| GET | ``/simulation/comparisons/{id}`` | Get comparison |
72+
+--------+---------------------------------------------------+------------------------------+
73+
| GET | ``/simulation/templates`` | List scenario templates |
74+
+--------+---------------------------------------------------+------------------------------+
75+
| POST | ``/aggregation/compute`` | Compute population |
76+
| | | aggregation |
77+
+--------+---------------------------------------------------+------------------------------+
78+
| GET | ``/aggregation/dimensions`` | List demographic dimensions |
79+
+--------+---------------------------------------------------+------------------------------+
8780

8881
OAuth Scopes
8982
~~~~~~~~~~~~

spp_indicator/README.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
==================
2-
OpenSPP Statistics
3-
==================
1+
=================
2+
OpenSPP Indicator
3+
=================
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -17,7 +17,7 @@ OpenSPP Statistics
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
20-
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_statistic
20+
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_indicator
2121
:alt: OpenSPP/OpenSPP2
2222

2323
|badge1| |badge2| |badge3|
@@ -43,15 +43,15 @@ Key Capabilities
4343
Key Models
4444
~~~~~~~~~~
4545

46-
+---------------------------+-----------------------------------------+
47-
| Model | Description |
48-
+===========================+=========================================+
49-
| ``spp.statistic`` | A publishable statistic linked to a CEL |
50-
| | variable |
51-
+---------------------------+-----------------------------------------+
52-
| ``spp.statistic.context`` | Per-context presentation and privacy |
53-
| | overrides |
54-
+---------------------------+-----------------------------------------+
46+
+---------------------------+------------------------------------------+
47+
| Model | Description |
48+
+===========================+==========================================+
49+
| ``spp.statistic`` | A publishable statistic linked to a CEL |
50+
| | variable |
51+
+---------------------------+------------------------------------------+
52+
| ``spp.statistic.context`` | Per-context presentation and privacy |
53+
| | overrides |
54+
+---------------------------+------------------------------------------+
5555

5656
Configuration
5757
~~~~~~~~~~~~~
@@ -109,7 +109,7 @@ Bug Tracker
109109
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
110110
In case of trouble, please check there if your issue has already been reported.
111111
If you spotted it first, help us to smash it by providing a detailed and welcomed
112-
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_statistic%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
112+
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_indicator%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
113113

114114
Do not contact contributors directly about support or help with technical issues.
115115

@@ -135,6 +135,6 @@ Current maintainers:
135135

136136
|maintainer-jeremi| |maintainer-gonzalesedwin1123|
137137

138-
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_statistic>`_ project on GitHub.
138+
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_indicator>`_ project on GitHub.
139139

140140
You are welcome to contribute.

0 commit comments

Comments
 (0)