Skip to content

Commit

Permalink
Fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibautLeibel committed Apr 16, 2024
1 parent 5f00486 commit 6d1d2ff
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions edge_orchestrator/tests/fixtures/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def my_item_0(my_cameras_metadata_0, my_binaries_0):
category="tacos",
cameras_metadata=my_cameras_metadata_0,
binaries=my_binaries_0,
dimensions=[100, 100],
)


Expand All @@ -25,6 +26,7 @@ def my_item_1(my_cameras_metadata_1, my_binaries_1):
category="category_test",
cameras_metadata=my_cameras_metadata_1,
binaries=my_binaries_1,
dimensions=[100, 100],
)


Expand All @@ -36,6 +38,7 @@ def my_fake_item(my_cameras_metadata_1, my_fake_binaries):
category="category_test",
cameras_metadata=my_cameras_metadata_1,
binaries=my_fake_binaries,
dimensions=[100, 100],
)


Expand All @@ -47,6 +50,7 @@ def my_fake_item_2(my_cameras_metadata_3, my_fake_binaries_2):
category="category_test",
cameras_metadata=my_cameras_metadata_3,
binaries=my_fake_binaries_2,
dimensions=[100, 100],
)


Expand All @@ -58,4 +62,5 @@ def my_item_2(my_cameras_metadata_2, my_binaries_2):
category="tacos",
cameras_metadata=my_cameras_metadata_2,
binaries=my_binaries_2,
dimensions=[100, 100],
)
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def test_apply_crop_function_with_incorrect_box_should_log_an_error_and_return_t
@patch.object(PostgresTelemetrySink, "send")
async def test_set_decision_should_send_final_decision_to_telemetry_sink(self, mock_send):
# Given
item = Item(serial_number="", category="", cameras_metadata={}, binaries={})
item = Item(serial_number="", category="", cameras_metadata={}, binaries={}, dimensions=[])
item.id = "item_id"
inventory = JsonInventory(TEST_INVENTORY_PATH)
station_config = JsonStationConfig(TEST_STATION_CONFIGS_FOLDER_PATH, inventory, TEST_DATA_FOLDER_PATH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_save_item_binaries_should_write_image_on_filesystem(self, generate_id_m
category="category",
cameras_metadata={},
binaries={"camera_id": expected_picture},
dimensions=[100, 100],
)

# When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_save_item_binaries_should_write_image_in_memory(self, generate_id_mocke
category="category",
cameras_metadata={},
binaries={"my_picture_name": expected_picture},
dimensions=[100, 100],
)

# When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_save_item_metadata_should_write_metadata_on_filesystem(
category="category",
cameras_metadata=my_cameras_metadata_0,
binaries={},
dimensions=[],
)
src_directory_path = Path(tmpdir.mkdir("metadata"))
metadata_storage = FileSystemMetadataStorage(src_directory_path)
Expand All @@ -33,6 +34,7 @@ def test_save_item_metadata_should_write_metadata_on_filesystem(
"station_config": item.station_config,
"cameras": item.cameras_metadata,
"received_time": item.received_time.strftime("%Y-%m-%d %H:%M:%S"),
"dimensions": item.dimensions,
"inferences": item.inferences,
"decision": item.decision,
"state": item.state,
Expand Down Expand Up @@ -76,6 +78,7 @@ def test_get_item_state_should_return_expected_state(self, generate_id_mocked, t
category="category",
cameras_metadata=my_cameras_metadata_0,
binaries={},
dimensions=[],
)
item.state = SupervisorState.DONE.value
expected_state = item.state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_save_item_metadata_should_write_item_in_memory(self, my_item_0):
},
},
"received_time": "2021-05-19 15:00:00",
"dimensions": [100, 100],
"inferences": {},
"decision": {},
"state": None,
Expand All @@ -57,6 +58,7 @@ def test_get_item_metadata_should_return_requested_item_metadata(self, my_item_0
"camera_2": {"brightness": 100, "exposition": 100, "position": "left"},
},
"received_time": "2021-05-19 15:00:00",
"dimensions": [100, 100],
"inferences": {},
"decision": {},
"state": None,
Expand Down Expand Up @@ -92,6 +94,7 @@ def test_get_all_items_metadata_should_return_all_items(self, my_item_0, my_item
},
},
"received_time": "2021-05-19 15:00:00",
"dimensions": [100, 100],
"inferences": {},
"decision": {},
"state": None,
Expand All @@ -110,6 +113,7 @@ def test_get_all_items_metadata_should_return_all_items(self, my_item_0, my_item
}
},
"received_time": "2021-05-19 15:00:00",
"dimensions": [100, 100],
"inferences": {},
"decision": {},
"state": None,
Expand Down

0 comments on commit 6d1d2ff

Please sign in to comment.