Skip to content

Commit d8980f1

Browse files
Add profile request route-builder internal reuse guard
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 245cd23 commit d8980f1

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ This runs lint, format checks, compile checks, tests, and package build.
155155
- `tests/test_polling_loop_usage.py` (`while True` polling-loop centralization in `hyperbrowser/client/polling.py`),
156156
- `tests/test_profile_operation_metadata_usage.py` (profile manager operation-metadata usage enforcement),
157157
- `tests/test_profile_request_helper_usage.py` (profile manager request-helper usage enforcement),
158+
- `tests/test_profile_request_route_builder_internal_reuse.py` (profile request-wrapper route-builder internal reuse enforcement for profile-id paths),
158159
- `tests/test_profile_route_builder_usage.py` (profile request-helper route-builder usage enforcement),
159160
- `tests/test_profile_route_constants_usage.py` (profile manager route-constant usage enforcement),
160161
- `tests/test_profile_team_request_internal_reuse.py` (profile/team request-helper internal reuse of shared model request helpers),

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"tests/test_profile_operation_metadata_usage.py",
5252
"tests/test_profile_request_helper_usage.py",
5353
"tests/test_profile_team_request_internal_reuse.py",
54+
"tests/test_profile_request_route_builder_internal_reuse.py",
5455
"tests/test_profile_route_builder_usage.py",
5556
"tests/test_profile_route_constants_usage.py",
5657
"tests/test_type_utils_usage.py",

tests/test_ast_function_source_helper_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"tests/test_model_request_function_parse_boundary.py",
1515
"tests/test_model_request_function_transport_boundary.py",
1616
"tests/test_model_request_wrapper_internal_reuse.py",
17+
"tests/test_profile_request_route_builder_internal_reuse.py",
1718
"tests/test_request_wrapper_internal_reuse.py",
1819
"tests/test_session_recordings_follow_redirects_boundary.py",
1920
"tests/test_session_request_function_parse_boundary.py",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pytest
2+
3+
from tests.ast_function_source_utils import collect_function_sources
4+
5+
pytestmark = pytest.mark.architecture
6+
7+
8+
MODULE_PATH = "hyperbrowser/client/managers/profile_request_utils.py"
9+
10+
PROFILE_ID_WRAPPERS = (
11+
"get_profile_resource",
12+
"delete_profile_resource",
13+
"get_profile_resource_async",
14+
"delete_profile_resource_async",
15+
)
16+
17+
NON_PROFILE_ID_WRAPPERS = (
18+
"create_profile_resource",
19+
"list_profile_resources",
20+
"create_profile_resource_async",
21+
"list_profile_resources_async",
22+
)
23+
24+
25+
def test_profile_id_wrappers_use_profile_route_builder():
26+
function_sources = collect_function_sources(MODULE_PATH)
27+
for function_name in PROFILE_ID_WRAPPERS:
28+
function_source = function_sources[function_name]
29+
assert "build_profile_route(profile_id)" in function_source
30+
31+
32+
def test_non_profile_id_wrappers_do_not_use_profile_route_builder():
33+
function_sources = collect_function_sources(MODULE_PATH)
34+
for function_name in NON_PROFILE_ID_WRAPPERS:
35+
function_source = function_sources[function_name]
36+
assert "build_profile_route(profile_id)" not in function_source

0 commit comments

Comments
 (0)