|
18 | 18 | SherlockImportIpc2581Error, |
19 | 19 | SherlockImportODBError, |
20 | 20 | SherlockImportProjectZipArchiveError, |
| 21 | + SherlockImportProjectZipArchiveSingleModeError, |
21 | 22 | SherlockListCCAsError, |
22 | 23 | SherlockListStrainMapsError, |
23 | 24 | SherlockListThermalMapsError, |
@@ -48,6 +49,8 @@ def test_all(): |
48 | 49 | helper_test_delete_project(project) |
49 | 50 | helper_test_import_odb_archive(project) |
50 | 51 | helper_test_import_ipc2581_archive(project) |
| 52 | + helper_test_import_project_zip_archive(project) |
| 53 | + helper_test_import_project_zip_archive_single_mode(project) |
51 | 54 | helper_test_generate_project_report(project) |
52 | 55 | helper_test_list_ccas(project) |
53 | 56 | helper_test_add_cca(project) |
@@ -2337,28 +2340,74 @@ def helper_test_import_project_zip_archive(project): |
2337 | 2340 | project.import_project_zip_archive("", "Demos", "Tutorial Project.zip") |
2338 | 2341 | pytest.fail("No exception raised when using an invalid parameter") |
2339 | 2342 | except SherlockImportProjectZipArchiveError as e: |
2340 | | - assert str(e) == "Import zipped project archive error: Project name is required." |
| 2343 | + assert str(e) == "Import zipped project archive error: Project name is invalid." |
2341 | 2344 |
|
2342 | 2345 | try: |
2343 | 2346 | project.import_project_zip_archive("Tutorial Project", "", "Tutorial Project.zip") |
2344 | 2347 | pytest.fail("No exception raised when using an invalid parameter") |
2345 | 2348 | except SherlockImportProjectZipArchiveError as e: |
2346 | | - assert str(e) == "Import zipped project archive error: Project category is required." |
| 2349 | + assert str(e) == "Import zipped project archive error: Project category is invalid." |
2347 | 2350 |
|
2348 | 2351 | try: |
2349 | 2352 | project.import_project_zip_archive("Tutorial Project", "Demos", "") |
2350 | 2353 | pytest.fail("No exception raised when using an invalid parameter") |
2351 | 2354 | except SherlockImportProjectZipArchiveError as e: |
2352 | | - assert str(e) == "Import zipped project archive error: Archive file path is required." |
| 2355 | + assert str(e) == "Import zipped project archive error: Archive file path is invalid." |
2353 | 2356 |
|
2354 | 2357 | if project._is_connection_up(): |
2355 | 2358 | try: |
2356 | | - project.import_ipc2581_archive("Tutorial Project", "Demos", "Missing Archive File.zip") |
| 2359 | + project.import_project_zip_archive( |
| 2360 | + "Tutorial Project", "Demos", "Missing Archive File.zip" |
| 2361 | + ) |
2357 | 2362 | pytest.fail("No exception raised when using an invalid parameter") |
2358 | 2363 | except Exception as e: |
2359 | 2364 | assert type(e) == SherlockImportProjectZipArchiveError |
2360 | 2365 |
|
2361 | 2366 |
|
| 2367 | +def helper_test_import_project_zip_archive_single_mode(project): |
| 2368 | + """Test import_project_zip_archive_single_mode API""" |
| 2369 | + try: |
| 2370 | + project.import_project_zip_archive_single_mode( |
| 2371 | + "", "Demos", "Tutorial Project.zip", "New Tutorial Project" |
| 2372 | + ) |
| 2373 | + pytest.fail("No exception raised when using an invalid parameter") |
| 2374 | + except SherlockImportProjectZipArchiveSingleModeError as e: |
| 2375 | + assert str(e) == "Import zipped project archive error: Project name is invalid." |
| 2376 | + |
| 2377 | + try: |
| 2378 | + project.import_project_zip_archive_single_mode( |
| 2379 | + "Tutorial Project", "", "Tutorial Project.zip", "New Tutorial Project" |
| 2380 | + ) |
| 2381 | + pytest.fail("No exception raised when using an invalid parameter") |
| 2382 | + except SherlockImportProjectZipArchiveSingleModeError as e: |
| 2383 | + assert str(e) == "Import zipped project archive error: Project category is invalid." |
| 2384 | + |
| 2385 | + try: |
| 2386 | + project.import_project_zip_archive_single_mode( |
| 2387 | + "Tutorial Project", "Demos", "", "New Tutorial Project" |
| 2388 | + ) |
| 2389 | + pytest.fail("No exception raised when using an invalid parameter") |
| 2390 | + except SherlockImportProjectZipArchiveSingleModeError as e: |
| 2391 | + assert str(e) == "Import zipped project archive error: Archive file path is invalid." |
| 2392 | + |
| 2393 | + try: |
| 2394 | + project.import_project_zip_archive_single_mode("Tutorial Project", "Demos", "File.zip", "") |
| 2395 | + pytest.fail("No exception raised when using an invalid parameter") |
| 2396 | + except SherlockImportProjectZipArchiveSingleModeError as e: |
| 2397 | + assert str(e) == ( |
| 2398 | + "Import zipped project archive error: Directory of the destination file is invalid." |
| 2399 | + ) |
| 2400 | + |
| 2401 | + if project._is_connection_up(): |
| 2402 | + try: |
| 2403 | + project.import_project_zip_archive_single_mode( |
| 2404 | + "Tutorial Project", "Demos", "Missing Archive File.zip", "New Tutorial Project" |
| 2405 | + ) |
| 2406 | + pytest.fail("No exception raised when using an invalid parameter") |
| 2407 | + except Exception as e: |
| 2408 | + assert type(e) == SherlockImportProjectZipArchiveSingleModeError |
| 2409 | + |
| 2410 | + |
2362 | 2411 | def clean_up_after_add(project, project_name): |
2363 | 2412 | if project_name is not None: |
2364 | 2413 | project.delete_project(project_name) |
|
0 commit comments