Skip to content

Commit 339c273

Browse files
committed
feat: update setup fixture
1 parent 93a7c37 commit 339c273

File tree

3 files changed

+36
-47
lines changed

3 files changed

+36
-47
lines changed

driver.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/setup.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@
6363
ZN_CONCENTRATION_TRAIT,
6464
ZN_CONCENTRATION_VARIABLE,
6565
)
66+
from tests.router.sample.fixture import (
67+
CEA_BE00034067,
68+
LEAFDISC_061439,
69+
LEAFDISC_061440,
70+
PO_0006001,
71+
PO_0007010,
72+
PO_0025094,
73+
PO_0025161,
74+
)
6675
from tests.router.staff.fixture import CHRIS_B, JOHN_DOE, STEP_W
6776
from tests.router.study.fixture import BARLEY_PROJECT_STUDY, FIRST_STUDY, MAIZE_PROJECT_STUDY, SECOND_STUDY
6877
from tests.router.unit.fixture import DEGREE_DAY_REF, DEGREE_DAY_UNIT, KILO_PIXEL_UNIT, MICROGRAM_UNIT
@@ -273,6 +282,28 @@ async def async_main() -> None:
273282

274283
session.add_all([PLANT_061439, PLANT_061440, PLANT_TYPE, PLOT_894, PLOT_TYPE])
275284

285+
# Add sample
286+
CEA_BE00034067.plant_anatomical_entity = PO_0025161
287+
CEA_BE00034067.observation_unit = PLOT_894
288+
CEA_BE00034067.plant_structural_development_stage = PO_0025094
289+
LEAFDISC_061439.plant_anatomical_entity = PO_0006001
290+
LEAFDISC_061439.observation_unit = PLANT_061439
291+
LEAFDISC_061439.plant_structural_development_stage = PO_0007010
292+
LEAFDISC_061440.plant_anatomical_entity = PO_0006001
293+
LEAFDISC_061440.observation_unit = PLANT_061440
294+
LEAFDISC_061440.plant_structural_development_stage = PO_0007010
295+
296+
session.add_all(
297+
[
298+
PO_0006001,
299+
PO_0007010,
300+
PO_0025094,
301+
PO_0025161,
302+
CEA_BE00034067,
303+
LEAFDISC_061440,
304+
LEAFDISC_061439,
305+
]
306+
)
276307
await session.commit()
277308

278309
# for AsyncEngine created in function scope, close and

tests/router/sample/fixture.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ class AllSampleFixtureResponse:
4545
observation_unit_response: AllObservationUnitFixtureResponse
4646

4747

48-
PO_0025094 = Vocabulary(title="PO:0025094", accession_number="PO:0025094")
49-
BBCH_17 = Vocabulary(title="BBCH-17", accession_number="BBCH-17")
5048
PO_0007010 = Vocabulary(title="PO_0007010", accession_number="PO_0007010")
51-
PO_0000003 = Vocabulary(title="PO:0000003", accession_number="PO:0000003")
49+
PO_0025094 = Vocabulary(title="PO:0025094", accession_number="PO:0025094")
5250
PO_0025161 = Vocabulary(title="PO:0025161", accession_number="PO:0025161")
5351
PO_0006001 = Vocabulary(title="PO_0006001", accession_number="PO_0006001")
5452

53+
5554
LEAFDISC_061439 = Sample(
5655
title="leafdisc_061439",
5756
description="Leaves collected at harvest stage (Barley developmental stage 11)",
@@ -89,7 +88,6 @@ async def get_sample_fixture(
8988
**data.to_dict(),
9089
)
9190
if id is None:
92-
send_data.updated_at = None
9391
response = await post_fixture(PATH, send_data, test_client)
9492
else:
9593
response = await put_fixture(PATH, send_data, test_client, id)
@@ -162,6 +160,6 @@ async def setup_sample(
162160
anatomical_entity_response=setup_anatomical_entity,
163161
observation_unit_response=setup_observation_units,
164162
)
165-
await delete_fixture(PATH, cea_be.sample_response, test_client)
166-
await delete_fixture(PATH, leafdisc_061439.sample_response, test_client)
167-
await delete_fixture(PATH, leafdisc_061440.sample_response, test_client)
163+
await delete_fixture(PATH, cea_be.sample_response.json()["id"], test_client)
164+
await delete_fixture(PATH, leafdisc_061439.sample_response.json()["id"], test_client)
165+
await delete_fixture(PATH, leafdisc_061440.sample_response.json()["id"], test_client)

0 commit comments

Comments
 (0)