Skip to content

Commit 7a5b79f

Browse files
authored
BDD tests for project export (#946)
1 parent 91eb492 commit 7a5b79f

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (C) 2022-2025 Intel Corporation
2+
# LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
3+
4+
Feature: project export
5+
The user can export a project as a zip file with all, none or the latest active models.
6+
7+
Background: Geti platform with a workspace
8+
Given a workspace
9+
10+
Scenario Outline: Project export with models
11+
Given a trained project of type 'detection'
12+
When the user requests to export the project with '<included_models>'
13+
Then a job of type 'export_project' is scheduled
14+
And the job completes successfully within 3 minutes
15+
And the exported project can be downloaded and is <exported_project_size> MB
16+
17+
@wip
18+
Examples:
19+
| included_models | exported_project_size |
20+
| none | 8 |
21+
| latest_active | 49 |
22+
| all | 69 |

interactive_ai/tests/e2e/features/steps/project_import.py renamed to interactive_ai/tests/e2e/features/steps/project_import_export.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from typing import TYPE_CHECKING
77

8-
from behave import given, when
8+
from behave import given, then, when
99
from behave.runner import Context
1010
from file_management import download_file_from_remote_archive
1111
from static_definitions import ProjectType, TrainerType
@@ -140,3 +140,31 @@ def step_when_user_uploads_project_to_new_project(context: Context) -> None:
140140
import_project_request={"file_id": file_id},
141141
)
142142
context.job_id = import_response.job_id
143+
144+
145+
@when("the user requests to export the project with '{included_models}'")
146+
def step_when_user_requests_project_export(context: Context, included_models: str) -> None:
147+
project_ie_api: ProjectImportExportApi = context.project_import_export_api
148+
project_export_response = project_ie_api.trigger_project_export(
149+
organization_id=context.organization_id,
150+
workspace_id=context.workspace_id,
151+
project_id=context.project_id,
152+
include_models=included_models,
153+
)
154+
context.job_id = project_export_response.job_id
155+
156+
157+
@then("the exported project can be downloaded and is {exported_project_size} MB")
158+
def step_then_user_can_download_exported_project(context: Context, exported_project_size: int) -> None:
159+
metadata = context.job_info.actual_instance.metadata
160+
expected_size = int(exported_project_size) * 1000000
161+
assert expected_size <= int(metadata.size) < expected_size + 1000000
162+
download_url = metadata.download_url
163+
export_id = download_url.split("/")[-2]
164+
project_import_export_api = context.project_import_export_api
165+
project_import_export_api.download_exported_project(
166+
organization_id=context.organization_id,
167+
workspace_id=context.workspace_id,
168+
project_id=context.project_id,
169+
export_operation_id=export_id,
170+
)

0 commit comments

Comments
 (0)