Skip to content

Commit d5f4676

Browse files
fix: Rename pilot_agents_db to pilot_db
1 parent 42f29a3 commit d5f4676

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def pilot_login(
7676
async def refresh_pilot_tokens(
7777
auth_db: AuthDB,
7878
settings: AuthSettings,
79-
pilot_agents_db: PilotAgentsDB,
79+
pilot_db: PilotAgentsDB,
8080
refresh_token: Annotated[
8181
str, Body(description="Refresh Token given at login by DiracX.")
8282
],
@@ -88,7 +88,7 @@ async def refresh_pilot_tokens(
8888
pilot_stamp=pilot_stamp,
8989
auth_db=auth_db,
9090
settings=settings,
91-
pilot_db=pilot_agents_db,
91+
pilot_db=pilot_db,
9292
refresh_token=refresh_token,
9393
)
9494
except (InvalidCredentialsError, PilotNotFoundError) as e:

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ async def update_secrets_constraints(
224224
dict[str, PilotSecretConstraints],
225225
Body(description="Mapping between secrets and pilots.", embed=False),
226226
],
227-
pilot_agents_db: PilotAgentsDB,
227+
pilot_db: PilotAgentsDB,
228228
user_info: Annotated[AuthorizedUserInfo, Depends(verify_dirac_access_token)],
229229
check_permissions: CheckPilotManagementPolicyCallable,
230230
):
@@ -237,12 +237,12 @@ async def update_secrets_constraints(
237237
await check_permissions(
238238
action=ActionType.CHANGE_PILOT_FIELD,
239239
pilot_stamps=pilot_stamps,
240-
pilot_db=pilot_agents_db,
240+
pilot_db=pilot_db,
241241
)
242242

243243
try:
244244
await update_secrets_constraints_bl(
245-
pilot_db=pilot_agents_db,
245+
pilot_db=pilot_db,
246246
secrets_to_constraints_dict=secrets_to_constraints_dict,
247247
)
248248
except SecretNotFoundError as e:

diracx-routers/tests/pilots/test_pilot_auth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ def non_mocked_hosts(test_client) -> list[str]:
6060
async def add_stamps(test_client):
6161
db = test_client.app.dependency_overrides[PilotAgentsDB.transaction].args[0]
6262

63-
async with db as pilot_agents_db:
63+
async with db as pilot_db:
6464
# Add pilots
6565
refs = [f"ref_{i}" for i in range(N)]
6666
stamps = [f"stamp_{i}" for i in range(N)]
6767
pilot_references = dict(zip(stamps, refs))
6868

6969
vo = MAIN_VO
7070

71-
await pilot_agents_db.add_pilots_bulk(
71+
await pilot_db.add_pilots_bulk(
7272
stamps, vo, grid_type="DIRAC", pilot_references=pilot_references
7373
)
7474

@@ -81,7 +81,7 @@ async def add_stamps(test_client):
8181
async def add_secrets_and_time(test_client, add_stamps, secret_duration_sec):
8282
db = test_client.app.dependency_overrides[PilotAgentsDB.transaction].args[0]
8383

84-
async with db as pilot_agents_db:
84+
async with db as pilot_db:
8585
# Retrieve the stamps from the add_stamps fixture
8686
stamps = [pilot["PilotStamp"] for pilot in add_stamps]
8787

@@ -94,7 +94,7 @@ async def add_secrets_and_time(test_client, add_stamps, secret_duration_sec):
9494
}
9595

9696
# Add creds
97-
await pilot_agents_db.insert_unique_secrets_bulk(
97+
await pilot_db.insert_unique_secrets_bulk(
9898
hashed_secrets=hashed_secrets, secret_constraints=constraints
9999
)
100100

@@ -110,7 +110,7 @@ async def add_secrets_and_time(test_client, add_stamps, secret_duration_sec):
110110
for secret_obj in secrets_obj
111111
]
112112

113-
await pilot_agents_db.set_secret_expirations_bulk(
113+
await pilot_db.set_secret_expirations_bulk(
114114
secret_uuids=[secret_obj["SecretUUID"] for secret_obj in secrets_obj],
115115
pilot_secret_expiration_dates=expiration_date,
116116
)

0 commit comments

Comments
 (0)