Skip to content
Snippets Groups Projects
Commit daf2f347 authored by Hoa Ben The Nguyen's avatar Hoa Ben The Nguyen
Browse files

fix: test for add_new_lidar_measurement

parent fc0344bd
No related branches found
No related tags found
No related merge requests found
Showing
with 7 additions and 23 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -37,13 +37,14 @@ def add_new_lidar_measurement(lake_name: str, lat: float, lon: float):
# time last updated data
time_now = datetime.now().utcnow().replace(microsecond=0)
measurement_data = []
content = []
# check if water body data exist, else create
if os.path.exists(file_path):
# get the areas from the map's data
with open(file_path) as data:
measurement_data = json.load(data)
measurement_data.append(json.load(data))
# create an empty container for new measurement
new_measurement_data = {
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -31,8 +31,8 @@ def test_add_new_lidar_measurement_valid_lake() -> None:
expected = 200
print("sub", u)
# remove temporary files and directories
#if os.path.exists(file_path):
# os.remove(file_path)
if os.path.exists(file_path):
os.remove(file_path)
if os.path.isdir(dir_path):
os.rmdir(dir_path)
......
{
"MeasurementID": 0,
"TimeMeasured": "2024-05-17 17:57:33",
"CenterLat": 0.0,
"CenterLon": 0.0,
"Sensor": {
"SensorId": 2,
"SensorType": "LiDar",
"Active": true
},
"Subdivisions": []
}
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
'''import os
import os
import json
from shapely.geometry import Polygon, LineString
......@@ -51,6 +51,3 @@ def test_write_json_to_file() -> None:
# Remove the test file
os.remove(test_path)
'''
\ No newline at end of file
'''from server.map_handler.get_lake_relation import fetch_data
from server.map_handler.get_lake_relation import fetch_data
def test_fetch_data_true() -> None:
......@@ -23,4 +23,3 @@ def test_fetch_data_no_lake() -> None:
status_code, _ = fetch_data(test_lake_name, False)
assert status_code == 404
'''
\ No newline at end of file
'''from server.map_handler.update_measurements import update_measurements
from server.map_handler.update_measurements import update_measurements
def test_update_measurements_invalid_lake() -> None:
test_lake_name = "test_lake"
......@@ -13,4 +13,3 @@ def test_update_measurements_valid_lake() -> None:
status_code, _ = update_measurements(test_lake_name)
assert status_code == 200
'''
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment