Skip to content

Commit 315a77b

Browse files
author
Robin VAN DE MERGHEL
committed
fix: Changed search endpoint
1 parent 7a25560 commit 315a77b

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

diracx-client/src/diracx/client/_generated/operations/_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def build_pilots_search_request(*, page: int = 1, per_page: int = 100, **kwargs:
693693
accept = _headers.pop("Accept", "application/json")
694694

695695
# Construct URL
696-
_url = "/api/pilots/management/search"
696+
_url = "/api/pilots/search"
697697

698698
# Construct parameters
699699
if page is not None:

diracx-routers/src/diracx/routers/pilots/management.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from http import HTTPStatus
44
from typing import Annotated
55

6-
from fastapi import Body, Depends, HTTPException, Query, status
6+
from fastapi import Body, HTTPException, Query, status
77

88
from diracx.core.exceptions import (
99
PilotAlreadyAssociatedWithJobError,
@@ -28,7 +28,6 @@
2828

2929
from ..dependencies import PilotAgentsDB
3030
from ..fastapi_classes import DiracxRouter
31-
from ..utils.users import AuthorizedUserInfo, verify_dirac_access_token
3231
from .access_policies import (
3332
ActionType,
3433
CheckPilotManagementPolicyCallable,

diracx-routers/src/diracx/routers/pilots/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
}
105105

106106

107-
@router.post("/management/search", responses=EXAMPLE_RESPONSES)
107+
@router.post("/search", responses=EXAMPLE_RESPONSES)
108108
async def search(
109109
pilot_db: PilotAgentsDB,
110110
check_permissions: CheckPilotManagementPolicyCallable,

diracx-routers/tests/pilots/test_pilot_creation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async def test_create_pilot_and_modify_it(normal_test_client):
172172
"distinct": True,
173173
}
174174

175-
r = normal_test_client.post("/api/pilots/management/search", json=body)
175+
r = normal_test_client.post("/api/pilots/search", json=body)
176176
assert r.status_code == 200, r.json()
177177
pilot1 = r.json()[0]
178178
pilot2 = r.json()[1]
@@ -279,7 +279,7 @@ async def test_associate_job_with_pilot_and_get_it(normal_test_client: TestClien
279279
)
280280

281281
r = normal_test_client.post(
282-
"/api/pilots/management/search",
282+
"/api/pilots/search",
283283
json={"parameters": [], "search": [condition], "sorts": []},
284284
)
285285

@@ -335,7 +335,7 @@ async def test_delete_pilots_by_age_and_stamp(normal_test_client):
335335

336336
# -------------- Verify all 100 pilots exist --------------
337337
search_body = {"parameters": [], "search": [], "sort": [], "distinct": True}
338-
r = normal_test_client.post("/api/pilots/management/search", json=search_body)
338+
r = normal_test_client.post("/api/pilots/search", json=search_body)
339339
assert r.status_code == 200, r.json()
340340
assert len(r.json()) == 100
341341

@@ -347,7 +347,7 @@ async def test_delete_pilots_by_age_and_stamp(normal_test_client):
347347
)
348348
assert r.status_code == 204
349349
# Expect 75 remaining
350-
r = normal_test_client.post("/api/pilots/management/search", json=search_body)
350+
r = normal_test_client.post("/api/pilots/search", json=search_body)
351351
assert len(r.json()) == 75
352352

353353
# -------------- 2) Delete all old pilots (remaining 25 old) --------------
@@ -358,15 +358,15 @@ async def test_delete_pilots_by_age_and_stamp(normal_test_client):
358358
assert r.status_code == 204
359359

360360
# Expect 50 remaining
361-
r = normal_test_client.post("/api/pilots/management/search", json=search_body)
361+
r = normal_test_client.post("/api/pilots/search", json=search_body)
362362
assert len(r.json()) == 50
363363

364364
# -------------- 3) Delete one recent pilot by stamp --------------
365365
one_stamp = pilot_stamps[10]
366366
r = normal_test_client.delete("/api/pilots/", params={"pilot_stamps": [one_stamp]})
367367
assert r.status_code == 204
368368
# Expect 49 remaining
369-
r = normal_test_client.post("/api/pilots/management/search", json=search_body)
369+
r = normal_test_client.post("/api/pilots/search", json=search_body)
370370
assert len(r.json()) == 49
371371

372372
# -------------- 4) Delete all remaining pilots --------------
@@ -375,7 +375,7 @@ async def test_delete_pilots_by_age_and_stamp(normal_test_client):
375375
r = normal_test_client.delete("/api/pilots/", params={"pilot_stamps": remaining})
376376
assert r.status_code == 204
377377
# Expect none remaining
378-
r = normal_test_client.post("/api/pilots/management/search", json=search_body)
378+
r = normal_test_client.post("/api/pilots/search", json=search_body)
379379
assert r.status_code == 200
380380
assert len(r.json()) == 0
381381

diracx-routers/tests/pilots/test_query.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ async def _search(
9696

9797
params = {"per_page": per_page, "page": page}
9898

99-
r = populated_pilot_client.post(
100-
"/api/pilots/management/search", json=body, params=params
101-
)
99+
r = populated_pilot_client.post("/api/pilots/search", json=body, params=params)
102100

103101
if r.status_code == 400:
104102
# If we have a status_code 400, that means that the query failed

extensions/gubbins/gubbins-client/src/gubbins/client/_generated/operations/_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def build_pilots_search_request(*, page: int = 1, per_page: int = 100, **kwargs:
742742
accept = _headers.pop("Accept", "application/json")
743743

744744
# Construct URL
745-
_url = "/api/pilots/management/search"
745+
_url = "/api/pilots/search"
746746

747747
# Construct parameters
748748
if page is not None:

0 commit comments

Comments
 (0)