|
| 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_WRAPPER_EXPECTATIONS = { |
| 9 | + "hyperbrowser/client/managers/agent_start_utils.py": { |
| 10 | + "start_agent_task": ("start_job(",), |
| 11 | + "start_agent_task_async": ("start_job_async(",), |
| 12 | + }, |
| 13 | + "hyperbrowser/client/managers/agent_task_read_utils.py": { |
| 14 | + "get_agent_task": ("get_job(",), |
| 15 | + "get_agent_task_status": ("get_job_status(",), |
| 16 | + "get_agent_task_async": ("get_job_async(",), |
| 17 | + "get_agent_task_status_async": ("get_job_status_async(",), |
| 18 | + }, |
| 19 | + "hyperbrowser/client/managers/agent_stop_utils.py": { |
| 20 | + "stop_agent_task": ("put_job_action(", 'action_suffix="/stop"'), |
| 21 | + "stop_agent_task_async": ("put_job_action_async(", 'action_suffix="/stop"'), |
| 22 | + }, |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +def test_agent_request_wrappers_delegate_to_expected_job_helpers(): |
| 27 | + for module_path, wrapper_expectations in MODULE_WRAPPER_EXPECTATIONS.items(): |
| 28 | + function_sources = collect_function_sources(module_path) |
| 29 | + for wrapper_name, expected_markers in wrapper_expectations.items(): |
| 30 | + wrapper_source = function_sources[wrapper_name] |
| 31 | + for expected_marker in expected_markers: |
| 32 | + assert expected_marker in wrapper_source |
| 33 | + assert "client.transport." not in wrapper_source |
| 34 | + assert "parse_response_model(" not in wrapper_source |
0 commit comments