Skip to content

Commit 4a09d4b

Browse files
authored
Merge branch 'main' into feature/CDD-3295-dual-category-chart-interface
2 parents bcb1ae9 + 45de445 commit 4a09d4b

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

metrics/api/urls_construction.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def construct_public_api_urlpatterns(
138138
cold_alert_list = ColdAlertViewSet.as_view({"get": "list"})
139139
cold_alert_detail = ColdAlertViewSet.as_view({"get": "retrieve"})
140140

141-
permission_set_urlpatterns = [
141+
generic_permission_set_urlpatterns = [
142142
path(
143143
f"{API_PREFIX}data-hierarchy/subthemes/<str:theme_id>",
144144
SubThemesByThemeView.as_view(),
@@ -159,6 +159,8 @@ def construct_public_api_urlpatterns(
159159
GeographiesByGeographyTypeView.as_view(),
160160
name="get_geographies",
161161
),
162+
]
163+
permission_set_urlpatterns = [
162164
path(
163165
f"{API_PREFIX}user/<str:user_id>/permissions",
164166
UserPermissionSetsByUserIdView.as_view(),
@@ -313,13 +315,15 @@ def construct_urlpatterns(
313315
constructed_url_patterns += construct_cms_admin_urlpatterns(
314316
app_mode=app_mode
315317
)
318+
constructed_url_patterns += generic_permission_set_urlpatterns
316319
constructed_url_patterns += audit_api_urlpatterns
317320
case enums.AppMode.PUBLIC_API.value:
318321
constructed_url_patterns += construct_public_api_urlpatterns(
319322
app_mode=app_mode
320323
)
321324
case enums.AppMode.PRIVATE_API.value:
322325
constructed_url_patterns += private_api_urlpatterns
326+
constructed_url_patterns += generic_permission_set_urlpatterns
323327
constructed_url_patterns += permission_set_urlpatterns
324328
case enums.AppMode.FEEDBACK_API.value:
325329
constructed_url_patterns += feedback_urlpatterns
@@ -338,5 +342,6 @@ def construct_urlpatterns(
338342
constructed_url_patterns += feedback_urlpatterns
339343
constructed_url_patterns += audit_api_urlpatterns
340344
constructed_url_patterns += permission_set_urlpatterns
345+
constructed_url_patterns += generic_permission_set_urlpatterns
341346

342347
return constructed_url_patterns

requirements-prod.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ grimp==3.14
3131
gunicorn==26.0.0
3232
html5lib==1.1
3333
identify==2.6.19
34-
idna==3.16
34+
idna==3.17
3535
importlib-metadata==9.0.0
3636
inflection==0.5.1
3737
iniconfig==2.3.0
@@ -55,7 +55,7 @@ packaging==26.2
5555
pathspec==1.1.1
5656
pbr==7.0.3
5757
Pillow==12.2.0
58-
platformdirs==4.9.6
58+
platformdirs==4.10.0
5959
plotly==6.7.0
6060
pluggy==1.6.0
6161
pyjwt==2.13.0

tests/unit/metrics/api/test_urls_construction.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@
5757
"public_api",
5858
]
5959

60+
PERMISSION_SET_PATHS = [
61+
"api/user/<str:user_id>/permissions",
62+
"api/user/<str:user_id>/permissions/hierarchy",
63+
]
64+
65+
GENERIC_PERMISSION_SET_PATHS = [
66+
"api/data-hierarchy/subthemes/<str:theme_id>",
67+
"api/data-hierarchy/topics/<str:sub_theme_id>",
68+
"api/data-hierarchy/metrics/<str:topic_id>",
69+
"api/data-hierarchy/geographies/<str:geography_type_id>",
70+
]
71+
6072

6173
def _flatten_urls(*, urlpatterns: list[URLPattern | URLResolver]) -> list[URLPattern]:
6274
"""Takes a list of URLPatterns and URLResolvers and returns
@@ -183,7 +195,9 @@ class TestConstructUrlpatterns:
183195

184196
@pytest.mark.parametrize(
185197
"private_api_endpoint_path",
186-
PRIVATE_API_ENDPOINT_PATHS,
198+
PRIVATE_API_ENDPOINT_PATHS
199+
+ PERMISSION_SET_PATHS
200+
+ GENERIC_PERMISSION_SET_PATHS,
187201
)
188202
def test_private_api_mode_returns_private_api_urls(
189203
self, private_api_endpoint_path: str
@@ -369,7 +383,7 @@ def test_cms_admin_mode_returns_cms_admin_urls(self):
369383

370384
@pytest.mark.parametrize(
371385
"included_endpoint_path",
372-
AUDIT_API_ENDPOINT_PATHS,
386+
AUDIT_API_ENDPOINT_PATHS + GENERIC_PERMISSION_SET_PATHS,
373387
)
374388
def test_cms_admin_mode_returns_all_expected_urls(
375389
self, included_endpoint_path: str
@@ -392,7 +406,8 @@ def test_cms_admin_mode_returns_all_expected_urls(
392406
"excluded_endpoint_path",
393407
PRIVATE_API_ENDPOINT_PATHS
394408
+ PUBLIC_API_ENDPOINT_PATHS
395-
+ FEEDBACK_API_ENDPOINT_PATHS,
409+
+ FEEDBACK_API_ENDPOINT_PATHS
410+
+ PERMISSION_SET_PATHS,
396411
)
397412
def test_cms_admin_mode_does_not_return_other_urls(
398413
self, excluded_endpoint_path: str

0 commit comments

Comments
 (0)