@@ -106,35 +106,6 @@ def test_add_groundwater_level_observation(groundwater_level_sample, sensor):
106106 cleanup_post_test (Observation , data ["id" ])
107107
108108
109- # def test_add_geothermal_observation(geothermal_sample, sensor):
110- # payload = {
111- # "observation_datetime": "2025-01-01T00:00:00Z",
112- # "release_status": "draft",
113- # "observation_depth": 100,
114- # "value": 25.5,
115- # "sample_id": geothermal_sample.id,
116- # "sensor_id": sensor.id,
117- # "observed_property": "temperature",
118- # "unit": "deg C",
119- # }
120- # response = client.post("/observation/geothermal", json=payload)
121- # data = response.json()
122- # assert response.status_code == 201
123-
124- # assert "id" in data
125- # assert "created_at" in data
126- # assert data["observation_datetime"] == payload["observation_datetime"]
127- # assert data["release_status"] == payload["release_status"]
128- # assert data["observation_depth"] == payload["observation_depth"]
129- # assert data["value"] == payload["value"]
130- # assert data["sample_id"] == payload["sample_id"]
131- # assert data["sensor_id"] == payload["sensor_id"]
132- # assert data["observed_property"] == payload["observed_property"]
133- # assert data["unit"] == payload["unit"]
134-
135- # cleanup_post_test(Observation, data["id"])
136-
137-
138109# PATCH tests ==================================================================
139110
140111
@@ -224,48 +195,6 @@ def test_patch_water_chemistry_observation_404_wrong_activity_type(
224195 )
225196
226197
227- # def test_patch_geothermal_observation(geothermal_observation):
228- # payload = {"observation_depth": 4, "release_status": "private"}
229- # response = client.patch(
230- # f"/observation/geothermal/{geothermal_observation.id}", json=payload
231- # )
232- # assert response.status_code == 200
233- # data = response.json()
234- # assert data["observation_depth"] == payload["observation_depth"]
235- # assert data["release_status"] == payload["release_status"]
236-
237- # cleanup_patch_test(Observation, payload, geothermal_observation)
238-
239-
240- # def test_patch_geothermal_observation_404_not_found(geothermal_observation):
241- # bad_id = 999999
242- # payload = {"observation_depth": 8}
243- # response = client.patch(f"/observation/geothermal/{bad_id}", json=payload)
244- # assert response.status_code == 404
245- # data = response.json()
246- # assert data["detail"] == f"Observation with ID {bad_id} not found."
247-
248-
249- # def test_patch_geothermal_observation_404_wrong_activity_type(
250- # groundwater_level_observation, water_chemistry_observation
251- # ):
252- # for obs in groundwater_level_observation, water_chemistry_observation:
253- # payload = {"value": 8}
254- # response = client.patch(f"/observation/geothermal/{obs.id}", json=payload)
255- # assert response.status_code == 404
256- # data = response.json()
257-
258- # if obs.observed_property == "groundwater level":
259- # activity_type = "groundwater level"
260- # else:
261- # activity_type = "water chemistry"
262-
263- # assert (
264- # data["detail"][0]["msg"]
265- # == f"Observation with ID {obs.id} is not a geothermal observation. It is a {activity_type} observation."
266- # )
267-
268-
269198# ============= Get tests =================
270199
271200
@@ -592,87 +521,6 @@ def test_get_water_chemistry_observation_by_id_404_wrong_activity_type(
592521 assert data ["detail" ][0 ]["loc" ] == ["path" , "observation_id" ]
593522
594523
595- # def test_get_geothermal_observations(geothermal_observation):
596- # response = client.get("/observation/geothermal")
597- # assert response.status_code == 200
598- # data = response.json()
599- # assert data["total"] == 1
600- # assert data["items"][0]["id"] == geothermal_observation.id
601- # assert data["items"][0][
602- # "created_at"
603- # ] == geothermal_observation.created_at.isoformat().replace("+00:00", "Z")
604- # assert data["items"][0]["release_status"] == geothermal_observation.release_status
605- # assert data["items"][0]["sample_id"] == geothermal_observation.sample_id
606- # assert data["items"][0]["sensor_id"] == geothermal_observation.sensor_id
607- # assert (
608- # data["items"][0]["observation_datetime"]
609- # == geothermal_observation.observation_datetime
610- # )
611- # colon_index = geothermal_observation.observed_property.find(":")
612- # assert (
613- # data["items"][0]["observed_property"]
614- # == geothermal_observation.observed_property[colon_index + 1 :]
615- # )
616- # assert data["items"][0]["value"] == geothermal_observation.value
617- # assert data["items"][0]["unit"] == geothermal_observation.unit
618- # assert (
619- # data["items"][0]["observation_depth"]
620- # == geothermal_observation.observation_depth
621- # )
622-
623-
624- # def test_get_geothermal_observation_by_id(geothermal_observation):
625- # response = client.get(f"/observation/geothermal/{geothermal_observation.id}")
626- # assert response.status_code == 200
627- # data = response.json()
628- # assert data["id"] == geothermal_observation.id
629- # assert data["created_at"] == geothermal_observation.created_at.isoformat().replace(
630- # "+00:00", "Z"
631- # )
632- # assert data["release_status"] == geothermal_observation.release_status
633- # assert data["sample_id"] == geothermal_observation.sample_id
634- # assert data["sensor_id"] == geothermal_observation.sensor_id
635- # assert data["observation_datetime"] == geothermal_observation.observation_datetime
636- # colon_index = geothermal_observation.observed_property.find(":")
637- # assert (
638- # data["observed_property"]
639- # == geothermal_observation.observed_property[colon_index + 1 :]
640- # )
641- # assert data["value"] == geothermal_observation.value
642- # assert data["unit"] == geothermal_observation.unit
643- # assert data["observation_depth"] == geothermal_observation.observation_depth
644-
645-
646- # def test_get_geothermal_observation_by_id_404_not_found(geothermal_observation):
647- # bad_id = 99999
648- # response = client.get(f"/observation/geothermal/{bad_id}")
649- # assert response.status_code == 404
650- # data = response.json()
651- # assert data["detail"] == f"Observation with ID {bad_id} not found."
652-
653-
654- # def test_get_geothermal_observation_by_id_404_wrong_activity_type(
655- # water_chemistry_observation, groundwater_level_observation
656- # ):
657- # for obs in water_chemistry_observation, groundwater_level_observation:
658- # response = client.get(f"/observation/geothermal/{obs.id}")
659- # assert response.status_code == 404
660- # data = response.json()
661-
662- # if obs.observed_property == "groundwater level":
663- # actual_activity_type = "groundwater level"
664- # else:
665- # actual_activity_type = "water chemistry"
666-
667- # assert (
668- # data["detail"][0]["msg"]
669- # == f"Observation with ID {obs.id} is not a geothermal observation. It is a {actual_activity_type} observation."
670- # )
671- # assert data["detail"][0]["type"] == "value_error"
672- # assert data["detail"][0]["input"] == {"observation_id": obs.id}
673- # assert data["detail"][0]["loc"] == ["path", "observation_id"]
674-
675-
676524# JB's comment: I don't think that geographic filters are necessary for
677525# observations. I think that they should only be applicable to finding Things
678526# and locations. Then the user can proceed from there to find observations.
0 commit comments