Skip to content

Commit 98d676f

Browse files
committed
flake8
1 parent 77d13b8 commit 98d676f

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

tests/integration/test_rest_routes.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,26 @@ async def _launch_scan(
125125
< post_launch_ts
126126
)
127127

128-
# query the ScanRequests coll
128+
# check database
129+
rest_address = await _assert_db_scanrequests_coll(
130+
mongo_client, post_scan_body, post_resp
131+
)
132+
await _assert_db_skyscank8sjobs_coll(
133+
mongo_client, post_scan_body, post_resp, scanner_server_args, rest_address
134+
)
135+
136+
return post_resp # type: ignore[no-any-return]
137+
138+
139+
async def _assert_db_scanrequests_coll(
140+
mongo_client: AsyncIOMotorClient,
141+
post_scan_body: dict,
142+
post_resp: dict,
143+
) -> str:
144+
"""Query the ScanRequests coll.
145+
146+
Return the REST address
147+
"""
129148
doc_sr = await mongo_client["SkyDriver_DB"]["ScanRequests"].find_one(
130149
{"scan_id": post_resp["scan_id"]}, {"_id": 0}
131150
)
@@ -162,6 +181,16 @@ async def _launch_scan(
162181
)
163182
assert re.fullmatch(rf"{re.escape('http://localhost:')}\d+", doc_sr["rest_address"])
164183

184+
return doc_sr["rest_address"]
185+
186+
187+
async def _assert_db_skyscank8sjobs_coll(
188+
mongo_client: AsyncIOMotorClient,
189+
post_scan_body: dict,
190+
post_resp: dict,
191+
scanner_server_args: str,
192+
rest_address: str,
193+
):
165194
# query the SkyScanK8sJobs coll
166195
# -> since the scanner-server metadata is no longer stored in the manifest
167196
doc_k8s = await mongo_client["SkyDriver_DB"]["SkyScanK8sJobs"].find_one(
@@ -196,7 +225,7 @@ async def _launch_scan(
196225
},
197226
{
198227
"name": "SKYSCAN_SKYDRIVER_ADDRESS",
199-
"value": doc_sr["rest_address"],
228+
"value": rest_address,
200229
},
201230
{
202231
"name": "SKYSCAN_SKYDRIVER_SCAN_ID",
@@ -305,7 +334,7 @@ async def _launch_scan(
305334
"env": [
306335
{
307336
"name": "SKYSCAN_SKYDRIVER_ADDRESS",
308-
"value": doc_sr["rest_address"],
337+
"value": rest_address,
309338
},
310339
{"name": "SKYSCAN_SKYDRIVER_AUTH", "value": ""},
311340
{
@@ -347,8 +376,6 @@ async def _launch_scan(
347376
},
348377
}
349378

350-
return post_resp # type: ignore[no-any-return]
351-
352379

353380
async def _do_patch(
354381
rc: RestClient,

0 commit comments

Comments
 (0)