diff --git a/.github/scripts/upload_test_stats_datadog.py b/.github/scripts/upload_test_stats_datadog.py index 8cfc5728a..154c8e1ed 100644 --- a/.github/scripts/upload_test_stats_datadog.py +++ b/.github/scripts/upload_test_stats_datadog.py @@ -21,10 +21,24 @@ "tests/e2e/test_notebooks.py::test_all_recipes[tests/e2e/import_predictions.ipynb]": ( "import_predictions_ipynb" ), + "tests/e2e/test_notebooks.py::test_all_recipes[recipes/export_a_kili_project.ipynb]": ( + "export_a_kili_project_ipynb" + ), + "tests/e2e/test_notebooks.py::test_all_recipes[recipes/importing_video_assets.ipynb]": ( + "importing_video_assets_ipynb" + ), "tests/e2e/test_copy_project.py::test_copy_project_e2e_video": "copy_project_e2e_video", "tests/e2e/test_copy_project.py::test_copy_project_e2e_with_ocr_metadata": ( "copy_project_e2e_with_ocr_metadata" ), + "tests/e2e/test_projects.py::test_create_project": "create_project", + "tests/e2e/test_mutations_label.py::test_append_many_labels": "append_many_labels", + "tests/e2e/test_mutations_asset.py::test_append_many_assets": "append_many_assets", + "tests/e2e/test_mutations_asset.py::test_send_back_to_queue": "send_back_to_queue", + "tests/e2e/test_mutations_asset.py::test_delete_many_from_dataset": "delete_many_from_dataset", + "tests/e2e/test_mutations_asset.py::test_change_asset_external_ids": ( + "change_asset_external_ids" + ), } OWNER = "kili-technology" diff --git a/tests/e2e/test_mutations_asset.py b/tests/e2e/test_mutations_asset.py index 89c71c7c7..7d811a8d1 100644 --- a/tests/e2e/test_mutations_asset.py +++ b/tests/e2e/test_mutations_asset.py @@ -146,3 +146,49 @@ def test_update_properties_in_assets_external_id(kili, src_project): assert [asset["externalId"] for asset in assets_new] == ["1", "2", "3"] assert [asset["priority"] for asset in assets_new] == [1, 0, 0] + + +@pytest.fixture() +def src_project_no_assets(kili: Kili): + interface = { + "jobs": { + "DETECTION": { + "mlTask": "OBJECT_DETECTION", + "tools": ["rectangle"], + "instruction": "Is there a defect ? Where ? What kind ?", + "required": 0, + "isChild": False, + "content": { + "categories": { + "DEFECT_CLASS_1": {"name": "defect of class 1"}, + "DEFECT_CLASS_2": {"name": "defect of class 2"}, + "DEFECT_CLASS_3": {"name": "defect of class 3"}, + "DEFECT_CLASS_4": {"name": "defect of class 4"}, + }, + "input": "radio", + }, + } + } + } + + project = kili.create_project( + input_type="IMAGE", + json_interface=interface, + title="e2e test_add_many_assets", + ) + + yield project["id"] + + kili.delete_project(project["id"]) + + +def test_append_many_assets(kili: Kili, src_project_no_assets: str): + NB_ASSETS = 500 + img_url = "https://storage.googleapis.com/label-public-staging/car/car_1.jpg" + + kili.append_many_to_dataset( + project_id=src_project_no_assets, + content_array=[img_url] * NB_ASSETS, + ) + + assert kili.count_assets(src_project_no_assets) == NB_ASSETS diff --git a/tests/e2e/test_mutations_label.py b/tests/e2e/test_mutations_label.py index 2ba078875..f5ca2ba71 100644 --- a/tests/e2e/test_mutations_label.py +++ b/tests/e2e/test_mutations_label.py @@ -92,3 +92,51 @@ def test_e2e_append_labels_overwrite(kili: Kili, project: Dict): ] for label_id in old_pred_ids_asset_1: assert label_id not in new_label_ids + + +@pytest.fixture() +def project_and_asset_id(kili: Kili): + interface = { + "jobs": { + "CLASSIFICATION_JOB": { + "content": {"categories": {"A": {"children": [], "name": "A"}}, "input": "radio"}, + "instruction": "classif", + "mlTask": "CLASSIFICATION", + "required": 1, + "isChild": False, + } + } + } + + project = kili.create_project( + input_type="TEXT", + json_interface=interface, + title="test_append_many_labels", + ) + + kili.append_many_to_dataset( + project_id=project["id"], + content_array=["asset_content_1"], + external_id_array=["1"], + ) + + asset_id = kili.assets(project_id=project["id"], fields=("id",))[0] + + yield project["id"], asset_id["id"] + + kili.delete_project(project["id"]) + + +def test_append_many_labels(kili: Kili, project_and_asset_id): + project_id, asset_id = project_and_asset_id + + N_LABELS = 1000 + + kili.append_labels( + project_id=project_id, + asset_id_array=[asset_id] * N_LABELS, + json_response_array=[{"CLASSIFICATION_JOB": {"categories": [{"name": "A"}]}}] * N_LABELS, + label_type="DEFAULT", + ) + + assert kili.count_labels(project_id=project_id) == N_LABELS diff --git a/tests/e2e/test_projects.py b/tests/e2e/test_projects.py index 44f1868b0..34ef550fd 100644 --- a/tests/e2e/test_projects.py +++ b/tests/e2e/test_projects.py @@ -5,6 +5,20 @@ from kili.client import Kili +@pytest.fixture() +def project_name(kili: Kili): + project_name = "e2e test_create_project " + str(uuid.uuid4()) + + yield project_name + + project_id = kili.projects(search_query=f"%{project_name}%", first=1)[0]["id"] + kili.delete_project(project_id) + + +def test_create_project(project_name: str, kili: Kili): + _ = kili.create_project(input_type="TEXT", json_interface={}, title=project_name) + + @pytest.fixture() def projects_uuid(kili: Kili): projects_uuid = str(uuid.uuid4())