Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/api/endpoints/proposals/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ async def get_agency_locations(
GetProposalAgencyLocationsQueryBuilder(agency_id=proposed_agency_id)
)

@proposal_router.post("/agencies/{proposed_agency_id}/locations/{location_id}")
@proposal_router.post(
"/agencies/{proposed_agency_id}/locations/{location_id}",
dependencies=[Depends(get_admin_access_info)],
)
async def add_location_to_agency(
proposed_agency_id: int = Path(
description="Agency ID to add location to"
Expand All @@ -89,7 +92,10 @@ async def add_location_to_agency(
)
return MessageResponse(message="Location added to agency.")

@proposal_router.delete("/agencies/{proposed_agency_id}/locations/{location_id}")
@proposal_router.delete(
"/agencies/{proposed_agency_id}/locations/{location_id}",
dependencies=[Depends(get_admin_access_info)],
)
async def remove_location_from_agency(
proposed_agency_id: int = Path(
description="Agency ID to remove location from"
Expand All @@ -104,7 +110,10 @@ async def remove_location_from_agency(
)
return MessageResponse(message="Location removed from agency.")

@proposal_router.put("/agencies/{proposed_agency_id}")
@proposal_router.put(
"/agencies/{proposed_agency_id}",
dependencies=[Depends(get_admin_access_info)],
)
async def update_agency(
request: ProposalAgencyPutRequest,
proposed_agency_id: int = Path(
Expand Down
3 changes: 2 additions & 1 deletion src/api/endpoints/submit/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ async def submit_url(
409: {
"model": SubmitDataSourceURLDuplicateSubmissionResponse
}
}
},
dependencies=[Depends(get_standard_user_access_info)]
)
async def submit_data_source(
request: DataSourceSubmissionRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from pathlib import Path

Check warning on line 1 in tests/automated/integration/api/test_sensitive_endpoint_auth_config.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/automated/integration/api/test_sensitive_endpoint_auth_config.py#L1 <100>

Missing docstring in public module
Raw output
./tests/automated/integration/api/test_sensitive_endpoint_auth_config.py:1:1: D100 Missing docstring in public module


ROOT = Path(__file__).resolve().parents[4]


def test_proposal_mutation_routes_require_admin_auth():

Check warning on line 7 in tests/automated/integration/api/test_sensitive_endpoint_auth_config.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/automated/integration/api/test_sensitive_endpoint_auth_config.py#L7 <103>

Missing docstring in public function
Raw output
./tests/automated/integration/api/test_sensitive_endpoint_auth_config.py:7:1: D103 Missing docstring in public function
proposals_routes = (
ROOT / "src" / "api" / "endpoints" / "proposals" / "routes.py"
).read_text()

assert '"/agencies/{proposed_agency_id}/locations/{location_id}",\n dependencies=[Depends(get_admin_access_info)],' in proposals_routes
assert '"/agencies/{proposed_agency_id}",\n dependencies=[Depends(get_admin_access_info)],' in proposals_routes


def test_submit_data_source_requires_authenticated_user():

Check warning on line 16 in tests/automated/integration/api/test_sensitive_endpoint_auth_config.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/automated/integration/api/test_sensitive_endpoint_auth_config.py#L16 <103>

Missing docstring in public function
Raw output
./tests/automated/integration/api/test_sensitive_endpoint_auth_config.py:16:1: D103 Missing docstring in public function
submit_routes = (
ROOT / "src" / "api" / "endpoints" / "submit" / "routes.py"
).read_text()

assert (
'"/data-source",\n'
" response_model=SubmitDataSourceURLProposalResponse,\n"
" responses={\n"
" 409: {\n"
' "model": SubmitDataSourceURLDuplicateSubmissionResponse\n'
" }\n"
" },\n"
" dependencies=[Depends(get_standard_user_access_info)]"
) in submit_routes