diff --git a/tests/test_commands/conftest.py b/tests/test_commands/conftest.py index 806c221c..392f9e5f 100644 --- a/tests/test_commands/conftest.py +++ b/tests/test_commands/conftest.py @@ -41,6 +41,25 @@ ) from tests.test_commands.utils import cli_path_join, set_vcr_mode_env +custom_parametrize = pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, + ItemType.ENVIRONMENT, ItemType.EVENTHOUSE, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.LAKEHOUSE, ItemType.ML_EXPERIMENT, ItemType.ML_MODEL, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.REPORT, + ItemType.SQL_DATABASE, ItemType.SEMANTIC_MODEL, + ItemType.SPARK_JOB_DEFINITION, ItemType.WAREHOUSE, ItemType.COPYJOB, + ItemType.GRAPHQLAPI, ItemType.DATAFLOW, +]) + +basic_item_parametrize = pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.ENVIRONMENT, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, ItemType.ML_EXPERIMENT, + ItemType.ML_MODEL, ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, +]) + FILTER_HEADERS = [ "authorization", "client-request-id", diff --git a/tests/test_commands/recordings/test_commands/test_cd/class_setup.yaml b/tests/test_commands/recordings/test_commands/test_cd/class_setup.yaml index e8ce67f7..eb405374 100644 --- a/tests/test_commands/recordings/test_commands/test_cd/class_setup.yaml +++ b/tests/test_commands/recordings/test_commands/test_cd/class_setup.yaml @@ -11,12 +11,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": "My workspace", "description": "", "type": "Personal"}]}' headers: Access-Control-Expose-Headers: @@ -26,15 +26,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '323' + - '2271' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:08:23 GMT + - Wed, 28 Jan 2026 07:54:31 GMT Pragma: - no-cache RequestId: - - e5bfcae4-49fa-474f-8a54-cbc93765bb81 + - 77abc3e1-d0de-46fa-a502-5f7481fba1b4 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -42,7 +42,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -60,12 +60,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": "My workspace", "description": "", "type": "Personal"}]}' headers: Access-Control-Expose-Headers: @@ -75,15 +75,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '323' + - '2271' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:08:23 GMT + - Wed, 28 Jan 2026 07:54:32 GMT Pragma: - no-cache RequestId: - - 0d5c5e29-1383-47bb-be9c-bfc7e67f0b52 + - e4a5e1ab-b8f5-425f-9dd4-0466f46f58e5 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -91,7 +91,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -109,13 +109,13 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/capacities response: body: string: '{"value": [{"id": "00000000-0000-0000-0000-000000000004", "displayName": - "mocked_fabriccli_capacity_name", "sku": "F16", "region": "West Europe", "state": + "mocked_fabriccli_capacity_name", "sku": "F32", "region": "Central US", "state": "Active"}]}' headers: Access-Control-Expose-Headers: @@ -125,15 +125,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '456' + - '425' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:08:28 GMT + - Wed, 28 Jan 2026 07:54:36 GMT Pragma: - no-cache RequestId: - - 0baf4c77-8680-4f8e-a74a-bad86bf9361e + - eeeae5f9-f08e-4c4d-960f-5d2adf1692ff Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -141,7 +141,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -162,12 +162,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: POST uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"id": "24e77cc9-b249-414d-a402-05915759c048", "displayName": "fabriccli_WorkspacePerTestclass_000001", + string: '{"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}' headers: Access-Control-Expose-Headers: @@ -177,17 +177,17 @@ interactions: Content-Encoding: - gzip Content-Length: - - '189' + - '187' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:08:34 GMT + - Wed, 28 Jan 2026 07:54:43 GMT Location: - - https://api.fabric.microsoft.com/v1/workspaces/24e77cc9-b249-414d-a402-05915759c048 + - https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245 Pragma: - no-cache RequestId: - - f7af61ad-d2b4-413f-9069-6ce658374380 + - 0372c498-09a2-49c8-90cb-87657d8a34be Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -195,7 +195,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -213,13 +213,13 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (cd; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": - "My workspace", "description": "", "type": "Personal"}, {"id": "24e77cc9-b249-414d-a402-05915759c048", + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' headers: @@ -230,15 +230,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '355' + - '2305' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:18:20 GMT + - Wed, 28 Jan 2026 07:57:48 GMT Pragma: - no-cache RequestId: - - e40b801b-9e34-4a1a-b177-e0e9f9d372a5 + - 5ae56619-f725-40b9-b6ed-96fd627c4e5a Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -246,7 +246,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -264,9 +264,9 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (cd; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET - uri: https://api.fabric.microsoft.com/v1/workspaces/24e77cc9-b249-414d-a402-05915759c048/items + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items response: body: string: '{"value": []}' @@ -282,11 +282,11 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Tue, 02 Sep 2025 18:18:21 GMT + - Wed, 28 Jan 2026 07:57:49 GMT Pragma: - no-cache RequestId: - - 2703ca19-69b7-4f7e-bf50-fa05a75a3dd2 + - 582ae0d5-5b2b-43c7-a6a0-596de06a6bc5 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -294,7 +294,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -314,9 +314,9 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.0.0 (cd; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (cd; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: DELETE - uri: https://api.fabric.microsoft.com/v1/workspaces/24e77cc9-b249-414d-a402-05915759c048 + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245 response: body: string: '' @@ -332,11 +332,11 @@ interactions: Content-Type: - application/octet-stream Date: - - Tue, 02 Sep 2025 18:18:21 GMT + - Wed, 28 Jan 2026 07:57:49 GMT Pragma: - no-cache RequestId: - - 5c1c8141-9fdb-476a-aa16-562d08edcfeb + - 5481d436-c6e4-4acd-8c1f-560498a31da9 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -344,7 +344,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[DataPipeline].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[DataPipeline].yaml new file mode 100644 index 00000000..51947a27 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[DataPipeline].yaml @@ -0,0 +1,456 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:44 GMT + Pragma: + - no-cache + RequestId: + - 50b5c121-3cf5-439f-89ac-8074e61e8a0b + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:45 GMT + Pragma: + - no-cache + RequestId: + - e666144e-d328-48f6-923e-3ca98903e169 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:46 GMT + Pragma: + - no-cache + RequestId: + - 0214d75b-f3a3-4cb8-872e-6485dd0899ee + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "DataPipeline", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '110' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/dataPipelines + response: + body: + string: '{"id": "b858cf4c-229c-4d38-b2a5-b722bfb7d93f", "type": "DataPipeline", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '169' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:53 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - 9bb44f6a-22b5-4cac-af8c-89cffd59a243 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:53 GMT + Pragma: + - no-cache + RequestId: + - 135e48a8-7fe6-47d7-a4a8-39e25be4b0b7 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "b858cf4c-229c-4d38-b2a5-b722bfb7d93f", "type": "DataPipeline", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '180' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:55 GMT + Pragma: + - no-cache + RequestId: + - c6da64a7-8d40-4f4a-a397-dd0549890a04 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:55 GMT + Pragma: + - no-cache + RequestId: + - b6a02241-3004-4103-8aee-92a3e62772af + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "b858cf4c-229c-4d38-b2a5-b722bfb7d93f", "type": "DataPipeline", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '180' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:57 GMT + Pragma: + - no-cache + RequestId: + - b6e856a3-867d-4d02-a8d7-8b362ecb5c92 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/b858cf4c-229c-4d38-b2a5-b722bfb7d93f + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:54:57 GMT + Pragma: + - no-cache + RequestId: + - f71a4a0c-6fbe-42d2-8f8b-1d41b2d34a56 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Environment].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Environment].yaml new file mode 100644 index 00000000..3d11a66c --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Environment].yaml @@ -0,0 +1,456 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:58 GMT + Pragma: + - no-cache + RequestId: + - 2ae70b3f-902f-4f95-b66f-b3fbf72c938e + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:54:59 GMT + Pragma: + - no-cache + RequestId: + - da5d42cc-9e86-4d82-8808-9b198d2f9c90 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:00 GMT + Pragma: + - no-cache + RequestId: + - 3fe61469-b8e8-45a0-94dc-f39d82e5991a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "Environment", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '109' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/environments + response: + body: + string: '{"id": "d03b7d6c-c195-4e4e-9bad-47e56ca68569", "type": "Environment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '169' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:02 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - e80c024b-155e-4796-a518-6fd20104e018 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:04 GMT + Pragma: + - no-cache + RequestId: + - 515bc40c-ca1d-45e8-ba2b-5bc06fbaf1b7 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "d03b7d6c-c195-4e4e-9bad-47e56ca68569", "type": "Environment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '181' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:05 GMT + Pragma: + - no-cache + RequestId: + - 12b32c32-da92-4903-8030-897288612f3c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:05 GMT + Pragma: + - no-cache + RequestId: + - a781d042-01d3-4954-90d9-92f6faf4ad1f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "d03b7d6c-c195-4e4e-9bad-47e56ca68569", "type": "Environment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '181' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:07 GMT + Pragma: + - no-cache + RequestId: + - 4c657673-6c75-43ba-a4cc-85b6d12d8635 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/d03b7d6c-c195-4e4e-9bad-47e56ca68569 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:55:07 GMT + Pragma: + - no-cache + RequestId: + - 688d9341-e710-4f80-b6bb-66ef0f50ef31 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Eventstream].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Eventstream].yaml new file mode 100644 index 00000000..31ffbae9 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Eventstream].yaml @@ -0,0 +1,556 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:08 GMT + Pragma: + - no-cache + RequestId: + - 9c749001-a28c-4620-b358-9fefc70f4807 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:09 GMT + Pragma: + - no-cache + RequestId: + - 1c787b00-6139-429e-bb44-de2c2f0dea7a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:09 GMT + Pragma: + - no-cache + RequestId: + - 3697b861-fa1c-49e6-a561-49a20ed48faf + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "Eventstream", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '109' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/eventstreams + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:11 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/5637561a-32d0-4faf-9f1e-642dd8cd78bc + Pragma: + - no-cache + RequestId: + - 9272cf7c-708a-4023-ad3b-555aeb4d890a + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - 5637561a-32d0-4faf-9f1e-642dd8cd78bc + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/5637561a-32d0-4faf-9f1e-642dd8cd78bc + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-28T07:55:11.0213304", + "lastUpdatedTimeUtc": "2026-01-28T07:55:13.9906874", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '131' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:32 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/5637561a-32d0-4faf-9f1e-642dd8cd78bc/result + Pragma: + - no-cache + RequestId: + - 7f18b6e1-1a97-4bc8-87f2-71b550f3d077 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - 5637561a-32d0-4faf-9f1e-642dd8cd78bc + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/5637561a-32d0-4faf-9f1e-642dd8cd78bc/result + response: + body: + string: '{"id": "b67b0811-0c4b-4d30-8dc7-217aed0f5e27", "type": "Eventstream", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 28 Jan 2026 07:55:33 GMT + Pragma: + - no-cache + RequestId: + - 2ab39827-360a-49f2-bff6-02a7ba28a677 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:34 GMT + Pragma: + - no-cache + RequestId: + - 9e4eea6c-5fad-4f3e-b4c1-da37010762ef + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "b67b0811-0c4b-4d30-8dc7-217aed0f5e27", "type": "Eventstream", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '180' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:35 GMT + Pragma: + - no-cache + RequestId: + - 55ce9365-1ba5-4ee9-beb3-5d7429b6cdc0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:36 GMT + Pragma: + - no-cache + RequestId: + - 79c20153-7145-458b-b3e1-a0915e6e0a22 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "b67b0811-0c4b-4d30-8dc7-217aed0f5e27", "type": "Eventstream", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '180' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:36 GMT + Pragma: + - no-cache + RequestId: + - 86e1bba5-cf34-4daa-b701-d7aced51de1f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/b67b0811-0c4b-4d30-8dc7-217aed0f5e27 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:55:37 GMT + Pragma: + - no-cache + RequestId: + - 5dce35a3-b34e-421d-b868-3701be522c1d + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLDashboard].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLDashboard].yaml new file mode 100644 index 00000000..ba6fb058 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLDashboard].yaml @@ -0,0 +1,456 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:38 GMT + Pragma: + - no-cache + RequestId: + - 30cc875d-0329-474c-a0af-3263ead7dd3f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:39 GMT + Pragma: + - no-cache + RequestId: + - 0558eddc-a4e4-482d-8056-ab0871a46d4a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:39 GMT + Pragma: + - no-cache + RequestId: + - 622130b7-5f8b-4199-b773-63e4128b467d + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "KQLDashboard", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '110' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/kqlDashboards + response: + body: + string: '{"id": "af166615-3e19-4953-970f-6dc16e9d716c", "type": "KQLDashboard", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '172' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:42 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - 562a1e8c-7f0c-4072-a112-d80b7e49a59f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:42 GMT + Pragma: + - no-cache + RequestId: + - 205993fc-5354-4e7d-bb02-041a5edb0049 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "af166615-3e19-4953-970f-6dc16e9d716c", "type": "KQLDashboard", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '183' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:44 GMT + Pragma: + - no-cache + RequestId: + - ff6ffabc-10d9-49ec-991d-1df08da82531 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:45 GMT + Pragma: + - no-cache + RequestId: + - 6728c099-77b2-479c-999d-2c1ae9b18056 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "af166615-3e19-4953-970f-6dc16e9d716c", "type": "KQLDashboard", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '183' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:45 GMT + Pragma: + - no-cache + RequestId: + - 77f614fe-a2b1-4de7-bb46-7fcf3a03be36 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/af166615-3e19-4953-970f-6dc16e9d716c + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:55:46 GMT + Pragma: + - no-cache + RequestId: + - 4ef45823-9689-4c0b-8b18-8db49c94f69f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLQueryset].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLQueryset].yaml new file mode 100644 index 00000000..3db04e30 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[KQLQueryset].yaml @@ -0,0 +1,456 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:47 GMT + Pragma: + - no-cache + RequestId: + - 2727b098-232b-4f23-b50d-3fc484f86bdc + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:48 GMT + Pragma: + - no-cache + RequestId: + - b47cfcea-c552-4a4c-ae42-6941a5c28014 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:49 GMT + Pragma: + - no-cache + RequestId: + - 9fd4bf48-c977-4cfe-9a75-c370292f598c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "KQLQueryset", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '109' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/kqlQuerysets + response: + body: + string: '{"id": "9b5dd4ff-85b8-4edd-a127-7d3918cdf426", "type": "KQLQueryset", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '171' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:50 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - ffdcd9b5-dbb1-4aad-9e10-06014e75ab73 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:51 GMT + Pragma: + - no-cache + RequestId: + - 122b2f37-ca6d-48ba-908b-6c1ddcdcf930 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "9b5dd4ff-85b8-4edd-a127-7d3918cdf426", "type": "KQLQueryset", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '182' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:52 GMT + Pragma: + - no-cache + RequestId: + - a11d502c-76e2-4950-9ad9-3131e36ad6e3 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:52 GMT + Pragma: + - no-cache + RequestId: + - a83e6c0d-991f-45ba-a84b-989174b8faf5 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "9b5dd4ff-85b8-4edd-a127-7d3918cdf426", "type": "KQLQueryset", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '182' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:53 GMT + Pragma: + - no-cache + RequestId: + - 3a52c8d0-c99a-4baa-b78a-ccdeec817947 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/9b5dd4ff-85b8-4edd-a127-7d3918cdf426 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:55:53 GMT + Pragma: + - no-cache + RequestId: + - 050881c2-786c-40fa-996f-3c2c45a0e7cc + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLExperiment].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLExperiment].yaml new file mode 100644 index 00000000..942c84d2 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLExperiment].yaml @@ -0,0 +1,556 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:53 GMT + Pragma: + - no-cache + RequestId: + - 682fea49-96a2-45f6-8ba8-b023c3d0f38d + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:54 GMT + Pragma: + - no-cache + RequestId: + - 7ae9ba83-46ca-464c-b6b6-3958e0cf2e0a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:55 GMT + Pragma: + - no-cache + RequestId: + - f00f0baa-a7bc-4230-93a8-526e61b26ea8 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "MLExperiment", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '110' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/mlExperiments + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:55:56 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/9f48d8a6-cfb3-4501-96a9-87c22d5d79ce + Pragma: + - no-cache + RequestId: + - deacc5dc-b8d9-446d-8208-b2acce044590 + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - 9f48d8a6-cfb3-4501-96a9-87c22d5d79ce + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/9f48d8a6-cfb3-4501-96a9-87c22d5d79ce + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-28T07:55:56.4368672", + "lastUpdatedTimeUtc": "2026-01-28T07:55:57.3274901", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '132' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:18 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/9f48d8a6-cfb3-4501-96a9-87c22d5d79ce/result + Pragma: + - no-cache + RequestId: + - bcd9da69-b52c-4141-bb18-eaefaee5ed3e + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - 9f48d8a6-cfb3-4501-96a9-87c22d5d79ce + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/9f48d8a6-cfb3-4501-96a9-87c22d5d79ce/result + response: + body: + string: '{"id": "7a1e4792-6dbb-4c2f-b186-849fb506e1cd", "type": "MLExperiment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 28 Jan 2026 07:56:18 GMT + Pragma: + - no-cache + RequestId: + - 91ba00e3-d4cd-482f-9ea7-1fc4f127928c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:19 GMT + Pragma: + - no-cache + RequestId: + - 5c3612f1-21e0-4b90-aef8-e4b621becc03 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "7a1e4792-6dbb-4c2f-b186-849fb506e1cd", "type": "MLExperiment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '183' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:20 GMT + Pragma: + - no-cache + RequestId: + - 0b373565-3ada-4825-b1da-9f8441792acb + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:21 GMT + Pragma: + - no-cache + RequestId: + - 2afc9aff-b7ea-43df-9f67-6db122094ba3 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "7a1e4792-6dbb-4c2f-b186-849fb506e1cd", "type": "MLExperiment", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '183' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:21 GMT + Pragma: + - no-cache + RequestId: + - cdb769fc-ae3d-480c-b394-f067ac911db3 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/7a1e4792-6dbb-4c2f-b186-849fb506e1cd + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:56:22 GMT + Pragma: + - no-cache + RequestId: + - f8a82008-9b64-48c0-8c82-4181dc2f6dd8 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLModel].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLModel].yaml new file mode 100644 index 00000000..b4589251 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MLModel].yaml @@ -0,0 +1,555 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:22 GMT + Pragma: + - no-cache + RequestId: + - 0e0248a6-7897-441b-970d-33eccb136c84 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:23 GMT + Pragma: + - no-cache + RequestId: + - 19adbd28-018d-4303-a39f-78f1d4b09e27 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:24 GMT + Pragma: + - no-cache + RequestId: + - 9f30c9d1-cc0c-40fd-9418-d9b6b6baeb6e + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "MLModel", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '105' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/mlModels + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:25 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e + Pragma: + - no-cache + RequestId: + - dd3b6231-c413-4b93-afd0-f48c3564a797 + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - 4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-28T07:56:25.460591", + "lastUpdatedTimeUtc": "2026-01-28T07:56:26.0699657", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '130' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:47 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e/result + Pragma: + - no-cache + RequestId: + - 454ca944-3f44-4d6a-ac56-3abe6304b3e9 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - 4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/4e230d23-8c8b-41b7-aa83-cf5dd42d1f4e/result + response: + body: + string: '{"id": "30fe39f4-e2e6-4a63-aa5d-0331f8861058", "type": "MLModel", "displayName": + "fabcli000001", "description": "Created by fab", "workspaceId": "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 28 Jan 2026 07:56:47 GMT + Pragma: + - no-cache + RequestId: + - b0f7a605-355c-4faf-af2a-e9c5c60bcc2c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:49 GMT + Pragma: + - no-cache + RequestId: + - 5d8af6b9-fb61-407b-8694-a8df0cdce6c7 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "30fe39f4-e2e6-4a63-aa5d-0331f8861058", "type": "MLModel", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:49 GMT + Pragma: + - no-cache + RequestId: + - 70c6ce10-50f9-4ec0-a527-8a38a6b3340f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:50 GMT + Pragma: + - no-cache + RequestId: + - 19cd0eb1-96da-461c-990b-ed3126dd2754 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "30fe39f4-e2e6-4a63-aa5d-0331f8861058", "type": "MLModel", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:50 GMT + Pragma: + - no-cache + RequestId: + - fceee45c-5606-4347-bfa6-4cfc90cbdbc2 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/30fe39f4-e2e6-4a63-aa5d-0331f8861058 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:56:52 GMT + Pragma: + - no-cache + RequestId: + - 9b659099-4d60-4bbf-87be-b0951b944885 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MirroredDatabase].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MirroredDatabase].yaml new file mode 100644 index 00000000..4282b877 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[MirroredDatabase].yaml @@ -0,0 +1,458 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:52 GMT + Pragma: + - no-cache + RequestId: + - 61f26db1-18fa-474c-98b9-0d2caacadf61 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:53 GMT + Pragma: + - no-cache + RequestId: + - 8e2767ca-24a9-448c-98ef-d14a37314e94 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:54 GMT + Pragma: + - no-cache + RequestId: + - 0a1edcba-509f-4a90-a18e-4671a930f942 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "MirroredDatabase", "folderId": null, "definition": {"parts": [{"path": "mirroring.json", + "payload": "ewogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgInNvdXJjZSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiR2VuZXJpY01pcnJvciIsCiAgICAgICAgICAgICJ0eXBlUHJvcGVydGllcyI6IHt9CiAgICAgICAgfSwKICAgICAgICAidGFyZ2V0IjogewogICAgICAgICAgICAidHlwZSI6ICJNb3VudGVkUmVsYXRpb25hbERhdGFiYXNlIiwKICAgICAgICAgICAgInR5cGVQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAgImZvcm1hdCI6ICJEZWx0YSIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQ==", + "payloadType": "InlineBase64"}]}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '603' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/mirroredDatabases + response: + body: + string: '{"id": "124e1482-5b2e-4360-b59d-567d991ffa76", "type": "MirroredDatabase", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '170' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:57 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - 53feb2b7-f5e4-4337-9784-28ad6803f851 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:58 GMT + Pragma: + - no-cache + RequestId: + - a3fba8f6-93eb-4756-840a-f9fe45707f41 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "124e1482-5b2e-4360-b59d-567d991ffa76", "type": "MirroredDatabase", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '185' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:58 GMT + Pragma: + - no-cache + RequestId: + - 87b13c32-26bd-4fa2-943c-fe6035b86dc8 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:56:59 GMT + Pragma: + - no-cache + RequestId: + - ab4a6ed8-d07a-48e5-bdae-7bae8085c448 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "124e1482-5b2e-4360-b59d-567d991ffa76", "type": "MirroredDatabase", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '185' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:00 GMT + Pragma: + - no-cache + RequestId: + - ab66b3d0-7d96-4dde-8f61-dad2246baaa0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/124e1482-5b2e-4360-b59d-567d991ffa76 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:57:01 GMT + Pragma: + - no-cache + RequestId: + - 8de447e6-8fa1-4b4b-9ed4-c667d08b7027 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Notebook].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Notebook].yaml new file mode 100644 index 00000000..097f6441 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Notebook].yaml @@ -0,0 +1,558 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:02 GMT + Pragma: + - no-cache + RequestId: + - df7e001c-4f11-4acf-b33b-1f8cd79a9479 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:02 GMT + Pragma: + - no-cache + RequestId: + - fd9235a9-35ae-4ac1-a7ba-dffab538c53e + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:03 GMT + Pragma: + - no-cache + RequestId: + - 468fa066-e2df-4ea3-941c-65dc15a7435a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "Notebook", "folderId": null, "definition": {"parts": [{"path": "notebook-content.py", + "payload": "IyBGYWJyaWMgbm90ZWJvb2sgc291cmNlCgojIE1FVEFEQVRBICoqKioqKioqKioqKioqKioqKioqCgojIE1FVEEgewojIE1FVEEgICAia2VybmVsX2luZm8iOiB7CiMgTUVUQSAgICAgIm5hbWUiOiAic3luYXBzZV9weXNwYXJrIgojIE1FVEEgICB9LAojIE1FVEEgICAiZGVwZW5kZW5jaWVzIjoge30KIyBNRVRBIH0KCiMgQ0VMTCAqKioqKioqKioqKioqKioqKioqKgoKIyBXZWxjb21lIHRvIHlvdXIgbmV3IG5vdGVib29rCiMgVHlwZSBoZXJlIGluIHRoZSBjZWxsIGVkaXRvciB0byBhZGQgY29kZSEKCgojIE1FVEFEQVRBICoqKioqKioqKioqKioqKioqKioqCgojIE1FVEEgewojIE1FVEEgICAibGFuZ3VhZ2UiOiAicHl0aG9uIiwKIyBNRVRBICAgImxhbmd1YWdlX2dyb3VwIjogInN5bmFwc2VfcHlzcGFyayIKIyBNRVRBIH0K", + "payloadType": "InlineBase64"}]}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '764' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/notebooks + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:05 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/d47d1156-7dc5-4bc7-948e-8764225943e9 + Pragma: + - no-cache + RequestId: + - ab3079ef-ad31-4171-93ce-842a247dda37 + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - d47d1156-7dc5-4bc7-948e-8764225943e9 + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/d47d1156-7dc5-4bc7-948e-8764225943e9 + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-28T07:57:05.1730548", + "lastUpdatedTimeUtc": "2026-01-28T07:57:06.4230613", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '131' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:26 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/d47d1156-7dc5-4bc7-948e-8764225943e9/result + Pragma: + - no-cache + RequestId: + - 9606f60c-5827-4eb0-8909-e27c8b72da7a + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - d47d1156-7dc5-4bc7-948e-8764225943e9 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/d47d1156-7dc5-4bc7-948e-8764225943e9/result + response: + body: + string: '{"id": "5d890dc0-824b-471a-9a9e-57db182bb487", "type": "Notebook", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 28 Jan 2026 07:57:27 GMT + Pragma: + - no-cache + RequestId: + - 4ee90726-b2b4-4415-a28b-25492a92ac03 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:28 GMT + Pragma: + - no-cache + RequestId: + - 1fb655a8-5e42-4a6f-97aa-1a797209c932 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "5d890dc0-824b-471a-9a9e-57db182bb487", "type": "Notebook", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:29 GMT + Pragma: + - no-cache + RequestId: + - 937cf278-fd9a-470e-bfe6-a1d8d96684b3 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:30 GMT + Pragma: + - no-cache + RequestId: + - 6d4fb77d-9edc-455e-9bec-214cb2dd2a00 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "5d890dc0-824b-471a-9a9e-57db182bb487", "type": "Notebook", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:31 GMT + Pragma: + - no-cache + RequestId: + - e1ab4e47-149e-4b91-a31e-988c62683fd9 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/5d890dc0-824b-471a-9a9e-57db182bb487 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:57:31 GMT + Pragma: + - no-cache + RequestId: + - 0dd04c1e-fef6-4313-8bf5-38df08c222a1 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Reflex].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Reflex].yaml new file mode 100644 index 00000000..1664022a --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[Reflex].yaml @@ -0,0 +1,455 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:31 GMT + Pragma: + - no-cache + RequestId: + - bacde33b-69d2-4014-81d7-36d1612fee7b + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:32 GMT + Pragma: + - no-cache + RequestId: + - ab664174-6f79-4e9f-98aa-2588ad2f8d6b + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:32 GMT + Pragma: + - no-cache + RequestId: + - 35ea08a4-b187-40a6-a82a-de10eb0b1f92 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "Reflex", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '104' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/reflexes + response: + body: + string: '{"id": "92f5e445-1cad-479a-8b2a-6cf38709dcf9", "type": "Reflex", "displayName": + "fabcli000001", "description": "Created by fab", "workspaceId": "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '166' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:35 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - fc85e829-ce78-4e28-97da-5e7eefda4d99 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:36 GMT + Pragma: + - no-cache + RequestId: + - ca8172c3-0112-4088-9cc0-c938c5bea4cb + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "92f5e445-1cad-479a-8b2a-6cf38709dcf9", "type": "Reflex", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:36 GMT + Pragma: + - no-cache + RequestId: + - 911146ed-3b0d-4f64-8cd2-10c01d4eb755 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:37 GMT + Pragma: + - no-cache + RequestId: + - 38f2fbd3-d97f-4602-ad97-c6361152b0c5 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "92f5e445-1cad-479a-8b2a-6cf38709dcf9", "type": "Reflex", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '177' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:38 GMT + Pragma: + - no-cache + RequestId: + - b7113247-e423-46f9-ac3a-1f8c8e72cf45 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/92f5e445-1cad-479a-8b2a-6cf38709dcf9 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:57:39 GMT + Pragma: + - no-cache + RequestId: + - d6a8851c-183d-4d9e-9742-d3b30c4ea3be + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[SparkJobDefinition].yaml b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[SparkJobDefinition].yaml new file mode 100644 index 00000000..6b89c257 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_cd/test_cd_item_all_types_success[SparkJobDefinition].yaml @@ -0,0 +1,456 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:40 GMT + Pragma: + - no-cache + RequestId: + - b991d957-6c81-4fcb-bf23-7a6cc9e04b79 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:40 GMT + Pragma: + - no-cache + RequestId: + - 077c00d8-77a3-486a-85bf-bbe2d7eed974 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:42 GMT + Pragma: + - no-cache + RequestId: + - 4e6706f7-5041-44b0-b079-826c1468af77 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"description": "Created by fab", "displayName": "fabcli000001", "type": + "SparkJobDefinition", "folderId": null}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '116' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/sparkJobDefinitions + response: + body: + string: '{"id": "ceedc4c3-5401-43f6-a077-13e24fe86253", "type": "SparkJobDefinition", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}' + headers: + Access-Control-Expose-Headers: + - RequestId,ETag + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '173' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:43 GMT + ETag: + - '""' + Pragma: + - no-cache + RequestId: + - 113e0de4-0870-4f47-8704-46f2cf871eee + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:43 GMT + Pragma: + - no-cache + RequestId: + - a2363aa0-5746-4075-800c-6f65b3941177 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "ceedc4c3-5401-43f6-a077-13e24fe86253", "type": "SparkJobDefinition", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '184' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:45 GMT + Pragma: + - no-cache + RequestId: + - 9af36f43-7f9d-4809-88c6-fc09027a249c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "293fae32-f430-4d4f-9929-4cd04fc6d245", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2305' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:46 GMT + Pragma: + - no-cache + RequestId: + - 3fec00d5-8ea8-4a1d-93ca-2cf754c64517 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items + response: + body: + string: '{"value": [{"id": "ceedc4c3-5401-43f6-a077-13e24fe86253", "type": "SparkJobDefinition", + "displayName": "fabcli000001", "description": "Created by fab", "workspaceId": + "293fae32-f430-4d4f-9929-4cd04fc6d245"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '184' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 28 Jan 2026 07:57:47 GMT + Pragma: + - no-cache + RequestId: + - 6577cc90-61a9-408d-a7ee-63cca09b0b35 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/293fae32-f430-4d4f-9929-4cd04fc6d245/items/ceedc4c3-5401-43f6-a077-13e24fe86253 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Wed, 28 Jan 2026 07:57:47 GMT + Pragma: + - no-cache + RequestId: + - 0b2406ea-1cba-426f-8d8d-8799240ae598 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_open/class_setup.yaml b/tests/test_commands/recordings/test_commands/test_open/class_setup.yaml index 176c6627..1a9c1fca 100644 --- a/tests/test_commands/recordings/test_commands/test_open/class_setup.yaml +++ b/tests/test_commands/recordings/test_commands/test_open/class_setup.yaml @@ -350,4 +350,4 @@ interactions: status: code: 200 message: OK -version: 1 +version: 1 \ No newline at end of file diff --git a/tests/test_commands/test_assign.py b/tests/test_commands/test_assign.py index 13bcea91..401e8416 100644 --- a/tests/test_commands/test_assign.py +++ b/tests/test_commands/test_assign.py @@ -4,6 +4,8 @@ import argparse from unittest.mock import patch +import pytest + import fabric_cli.commands.fs.fab_fs_unassign as fab_unassign from fabric_cli.commands.fs import fab_fs_get from fabric_cli.core import fab_constant as constant @@ -13,6 +15,65 @@ class TestAssign: + # region Parametrized Tests + def test_assign_domain_workspace_success( + self, + workspace_factory, + cli_executor, + mock_questionary_print, + virtual_workspace_item_factory, + ): + # Setup + workspace = workspace_factory() + domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) + mock_questionary_print.reset_mock() + + # Execute command + cli_executor.exec_command( + f"assign {domain.full_path} --workspace {workspace.full_path} --force" + ) + + # Assert + get(domain.full_path, query="domainWorkspaces") + assert any( + workspace.display_name in str(call.args[0]) + for call in mock_questionary_print.mock_calls + ) + + @pytest.mark.parametrize("entity_type,factory_key,path_template", [ + (VirtualWorkspaceType.CAPACITY, "test_data", "/.capacities/{}.Capacity"), + (VirtualWorkspaceType.DOMAIN, "virtual_workspace_item_factory", "{}.full_path"), + ]) + def test_assign_entity_item_not_supported_failure( + self, + entity_type, + factory_key, + path_template, + item_factory, + cli_executor, + assert_fabric_cli_error, + test_data: StaticTestData, + virtual_workspace_item_factory, + ): + # Setup + lakehouse = item_factory(ItemType.LAKEHOUSE) + + if factory_key == "test_data": + entity_path = path_template.format(test_data.capacity.name) + else: + domain = virtual_workspace_item_factory(entity_type) + entity_path = domain.full_path + + # Execute command + cli_executor.exec_command( + f"assign {entity_path} --workspace {lakehouse.full_path} --force" + ) + + # Assert + assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) + + # endregion + # region ASSIGN def test_assign_capacity_workspace_success( self, @@ -122,70 +183,6 @@ def test_assign_capacity_workspace_without_force_cancel_operation_success( for call in mock_questionary_print.mock_calls ) - def test_assign_capacity_item_not_supported_failure( - self, - item_factory, - cli_executor, - assert_fabric_cli_error, - test_data: StaticTestData, - ): - # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) - capacity_full_path = f"/.capacities/{test_data.capacity.name}.Capacity" - - # Execute command - cli_executor.exec_command( - f"assign {capacity_full_path} --workspace {lakehouse.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) - - def test_assign_domain_workspace_success( - self, - virtual_workspace_item_factory, - workspace_factory, - mock_questionary_print, - cli_executor, - ): - # Setup - workspace = workspace_factory() - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) - - # Reset mock - mock_questionary_print.reset_mock() - - # Execute command - cli_executor.exec_command( - f"assign {domain.full_path} --workspace {workspace.full_path} --force" - ) - - # Assert - get(domain.full_path, query="domainWorkspaces") - assert any( - workspace.display_name in call.args[0] - for call in mock_questionary_print.mock_calls - ) - - def test_assign_domain_item_not_supported_failure( - self, - virtual_workspace_item_factory, - item_factory, - cli_executor, - assert_fabric_cli_error, - ): - # Setup - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) - lakehouse = item_factory(ItemType.LAKEHOUSE) - - # Execute command - cli_executor.exec_command( - f"assign {domain.full_path} --workspace {lakehouse.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) - # endregion diff --git a/tests/test_commands/test_cd.py b/tests/test_commands/test_cd.py index de9c0885..45ad4839 100644 --- a/tests/test_commands/test_cd.py +++ b/tests/test_commands/test_cd.py @@ -8,6 +8,7 @@ from fabric_cli.core.fab_types import ItemType from fabric_cli.core.hiearchy.fab_folder import Folder from fabric_cli.core.hiearchy.fab_hiearchy import Item, Tenant, Workspace +from tests.test_commands.conftest import basic_item_parametrize class TestCD: @@ -29,6 +30,20 @@ def test_cd_workspace_success(self, workspace, mock_print_done, cli_executor): assert isinstance(Context().context, Workspace) assert Context().context.name == workspace.name + @basic_item_parametrize + def test_cd_item_all_types_success(self, item_type, item_factory, mock_print_done, cli_executor): + # Setup + item = item_factory(item_type) + mock_print_done.reset_mock() + + # Execute command + cli_executor.exec_command(f"cd {item.full_path}") + + # Assert + mock_print_done.assert_called_once() + assert isinstance(Context().context, Item) + assert Context().context.name == item.name + @pytest.mark.parametrize( "special_character", [ @@ -82,19 +97,6 @@ def test_cd_workspace_with_special_characters_success( assert isinstance(Context().context, Workspace) assert Context().context.name == workspace.name - def test_cd_item_success(self, item_factory, mock_print_done, cli_executor): - # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) - mock_print_done.reset_mock() - - # Execute command - cli_executor.exec_command(f"cd {lakehouse.full_path}") - - # Assert - mock_print_done.assert_called_once() - assert isinstance(Context().context, Item) - assert Context().context.name == lakehouse.name - def test_cd_folder_success(self, folder_factory, mock_print_done, cli_executor): # Setup folder = folder_factory() diff --git a/tests/test_commands/test_cp.py b/tests/test_commands/test_cp.py index b29866dc..56d8ed6a 100644 --- a/tests/test_commands/test_cp.py +++ b/tests/test_commands/test_cp.py @@ -5,6 +5,7 @@ import os import shutil import tempfile +import pytest from unittest.mock import patch import fabric_cli.commands.fs.fab_fs_cp as fab_cp @@ -288,6 +289,11 @@ def test_cp_workspace_to_folder_success( rm(copied_notebook.full_path) rm(copied_eventhouse.full_path) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, + ]) def test_cp_item_to_item_success( self, workspace_factory, @@ -295,11 +301,12 @@ def test_cp_item_to_item_success( mock_print_done, mock_questionary_print, cli_executor: CLIExecutor, + item_type, ): # Setup ws1 = workspace_factory() ws2 = workspace_factory() - notebook = item_factory(ItemType.NOTEBOOK, ws1.full_path) + item = item_factory(item_type, ws1.full_path) # Reset mock mock_print_done.reset_mock() @@ -309,8 +316,8 @@ def test_cp_item_to_item_success( mock_confirm.return_value.ask.return_value = True # Execute command - to_path = cli_path_join(ws2.full_path, notebook.display_name + ".Notebook") - cli_executor.exec_command(f"cp {notebook.full_path} {to_path}") + to_path = cli_path_join(ws2.full_path, item.display_name + f".{item_type}") + cli_executor.exec_command(f"cp {item.full_path} {to_path}") # Assert mock_print_done.assert_called() @@ -318,14 +325,14 @@ def test_cp_item_to_item_success( mock_questionary_print.reset_mock() ls(ws1.full_path) assert any( - notebook.display_name in call.args[0] + item.display_name in call.args[0] for call in mock_questionary_print.mock_calls ) mock_questionary_print.reset_mock() ls(ws2.full_path) assert any( - notebook.display_name in call.args[0] + item.display_name in call.args[0] for call in mock_questionary_print.mock_calls ) @@ -374,17 +381,23 @@ def test_cp_item_to_item_type_mismatch_failure( # Assert assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) - def test_cp_virtual_workspace_item_domain_not_supported_failure( + @pytest.mark.parametrize("virtual_workspace_type", [ + VirtualWorkspaceType.DOMAIN, + VirtualWorkspaceType.CAPACITY, + VirtualWorkspaceType.GATEWAY, + ]) + def test_cp_virtual_workspace_item_not_supported_failure( self, virtual_workspace_item_factory, assert_fabric_cli_error, cli_executor: CLIExecutor, + virtual_workspace_type, ): # Setup - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) + virtual_item = virtual_workspace_item_factory(virtual_workspace_type) # Execute command - cli_executor.exec_command(f"cp {domain.full_path} {domain.full_path} --force") + cli_executor.exec_command(f"cp {virtual_item.full_path} {virtual_item.full_path} --force") # Assert assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) @@ -541,6 +554,52 @@ def test_cp_local_to_onelake_success( # Delete the temporary file os.remove(file_path) + def test_cp_onelake_operations_success( + self, + item_factory, + mock_print_done, + mock_questionary_print, + cli_executor: CLIExecutor, + ): + # Setup - Create two lakehouse items that support OneLake + lakehouse1 = item_factory(ItemType.LAKEHOUSE) + lakehouse2 = item_factory(ItemType.LAKEHOUSE) + + with tempfile.TemporaryDirectory() as tmp_dir: + file_name = "test_cp_lakehouse.txt" + file_path = cli_path_join(tmp_dir, file_name) + with open(file_path, "wb") as fp: + fp.write(b"Hello world!\n") + + lakehouse1_onelake_full_path = cli_path_join( + lakehouse1.full_path, "Files", file_name + ) + lakehouse2_onelake_full_path = cli_path_join(lakehouse2.full_path, "Files") + + # Reset mock + mock_print_done.reset_mock() + + with patch("questionary.confirm") as mock_confirm: + mock_confirm.return_value.ask.return_value = True + + # Upload local file to lakehouse1 + _upload_local_file_to_onelake(file_path, lakehouse1_onelake_full_path) + # Delete the temporary file + os.remove(file_path) + + # Execute command - OneLake to OneLake copy + cli_executor.exec_command( + f"cp {lakehouse1_onelake_full_path} {lakehouse2_onelake_full_path}" + ) + # Assert + mock_print_done.assert_called() + mock_questionary_print.reset_mock() + ls(lakehouse2_onelake_full_path) + assert any( + file_name in call.args[0] + for call in mock_questionary_print.mock_calls + ) + def test_cp_from_local_recursive_unsupported( self, item_factory, @@ -1033,6 +1092,73 @@ def test_cp_item_existing_name_different_location_with_block_on_path_collision_f ErrorMessages.Cp.item_exists_different_path(), ) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, + ]) + def test_cp_folder_with_different_item_types_success( + self, + workspace_factory, + folder_factory, + item_factory, + mock_print_done, + mock_print_warning, + mock_questionary_print, + cli_executor: CLIExecutor, + item_type, + ): + # Setup + ws1 = workspace_factory() + ws2 = workspace_factory() + f1 = folder_factory(path=ws1.full_path) + + # Create an item of the specified type in the folder + item = item_factory(item_type, path=f1.full_path) + + # Reset mock + mock_print_done.reset_mock() + + with patch("questionary.confirm") as mock_confirm: + mock_confirm.return_value.ask.return_value = True + + # Execute command + cli_executor.exec_command( + f"cp {f1.full_path} {ws2.full_path} --force --recursive" + ) + + f2 = EntityMetadata( + f1.display_name, f1.name, cli_path_join(ws2.full_path, f1.name) + ) + copied_item = EntityMetadata( + item.display_name, + item.name, + cli_path_join(f2.full_path, item.name), + ) + + # Assert + mock_print_done.assert_called() + mock_print_warning.assert_called_once() + mock_questionary_print.reset_mock() + + # Verify folder was copied + ls(ws2.full_path) + assert any( + f1.name in call.args[0] for call in mock_questionary_print.mock_calls + ) + + # Verify item was copied + mock_questionary_print.reset_mock() + ls(f2.full_path) + assert any( + item.name in call.args[0] + for call in mock_questionary_print.mock_calls + ) + + # Cleanup + rm(copied_item.full_path) + rm(f2.full_path) + # region Helper Methods def ls(path, long=False, all=False, query=None): diff --git a/tests/test_commands/test_exists.py b/tests/test_commands/test_exists.py index 98747fc5..cbe097df 100644 --- a/tests/test_commands/test_exists.py +++ b/tests/test_commands/test_exists.py @@ -1,9 +1,12 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +import pytest + from fabric_cli.core import fab_constant as constant from fabric_cli.core.fab_types import ItemType from tests.test_commands.data.static_test_data import StaticTestData +from tests.test_commands.conftest import custom_parametrize class TestExists: @@ -18,17 +21,18 @@ def test_exists_workspace_exists_success( mock_print_done.assert_called_once() assert constant.INFO_EXISTS_TRUE in mock_print_done.call_args[0][0] + @custom_parametrize def test_exists_item_exists_success( - self, item_factory, mock_print_done, cli_executor + self, item_factory, mock_print_done, cli_executor, item_type ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command - cli_executor.exec_command(f"exists {lakehouse.full_path}") + cli_executor.exec_command(f"exists {item.full_path}") # Assert mock_print_done.assert_called_once() @@ -46,51 +50,79 @@ def test_exists_virtual_workspace_item_capacity_exists_success( mock_print_done.assert_called_once() assert constant.INFO_EXISTS_TRUE in mock_print_done.call_args[0][0] + @pytest.mark.parametrize("item_type,folder_name", [ + (ItemType.LAKEHOUSE, "Files"), + (ItemType.LAKEHOUSE, "Tables"), + (ItemType.WAREHOUSE, "Tables"), + (ItemType.SPARK_JOB_DEFINITION, "Libs"), + (ItemType.SPARK_JOB_DEFINITION, "Main"), + (ItemType.KQL_DATABASE, "Tables"), + (ItemType.SQL_DATABASE, "Tables"), + (ItemType.SQL_DATABASE, "Files"), + (ItemType.MIRRORED_DATABASE, "Tables"), + (ItemType.MIRRORED_DATABASE, "Files"), + ]) def test_exists_onelake_exists_success( - self, item_factory, mock_print_done, cli_executor + self, item_factory, mock_print_done, cli_executor, item_type, folder_name ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command - cli_executor.exec_command(f"exists {lakehouse.full_path}/Files") + cli_executor.exec_command(f"exists {item.full_path}/{folder_name}") # Assert mock_print_done.assert_called_once() assert constant.INFO_EXISTS_TRUE in mock_print_done.call_args[0][0] + @custom_parametrize def test_exists_item_doesnt_exist_success( - self, item_factory, mock_print_done, cli_executor + self, item_factory, mock_print_done, cli_executor, item_type ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command - path = lakehouse.full_path.replace(".Lakehouse", "random.Lakehouse") + item_extension = f".{item_type.value}" + path = item.full_path.replace(item_extension, f"random{item_extension}") cli_executor.exec_command(f"exists {path}") # Assert mock_print_done.assert_called_once() assert constant.INFO_EXISTS_FALSE in mock_print_done.call_args[0][0] + @pytest.mark.parametrize("item_type,folder_name", [ + (ItemType.LAKEHOUSE, "Files"), + (ItemType.LAKEHOUSE, "Tables"), + (ItemType.WAREHOUSE, "Files"), + (ItemType.WAREHOUSE, "Tables"), + (ItemType.SEMANTIC_MODEL, "Tables"), + (ItemType.SPARK_JOB_DEFINITION, "Libs"), + (ItemType.SPARK_JOB_DEFINITION, "Main"), + (ItemType.KQL_DATABASE, "Tables"), + (ItemType.SQL_DATABASE, "Tables"), + (ItemType.SQL_DATABASE, "Files"), + (ItemType.MIRRORED_DATABASE, "Tables"), + (ItemType.MIRRORED_DATABASE, "Files"), + ]) def test_exists_onelake_doesnt_exist_success( - self, item_factory, mock_print_done, cli_executor + self, item_factory, mock_print_done, cli_executor, item_type, folder_name ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command cli_executor.exec_command( - f"exists {lakehouse.full_path}/Files/non_existent_file.txt" + f"exists {item.full_path}/{folder_name}/non_existent_file.txt" ) # Assert diff --git a/tests/test_commands/test_export.py b/tests/test_commands/test_export.py index dea4e303..9efef9a4 100644 --- a/tests/test_commands/test_export.py +++ b/tests/test_commands/test_export.py @@ -4,12 +4,20 @@ import platform from unittest.mock import ANY, patch +import pytest + from fabric_cli.core import fab_constant as constant from fabric_cli.core.fab_types import ItemType class TestExport: # region EXPORT + @pytest.mark.parametrize("item_type,expected_file_extension", [ + (ItemType.NOTEBOOK, ".ipynb"), + (ItemType.SPARK_JOB_DEFINITION, ".json"), + (ItemType.DATA_PIPELINE, ".json"), + (ItemType.MIRRORED_DATABASE, ".json") + ]) def test_export_item_success( self, item_factory, @@ -17,9 +25,11 @@ def test_export_item_success( mock_print_done, tmp_path, mock_print_warning, + item_type, + expected_file_extension, ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() @@ -27,19 +37,25 @@ def test_export_item_success( # Execute command cli_executor.exec_command( - f"export {notebook.full_path} --output {str(tmp_path)} --force" + f"export {item.full_path} --output {str(tmp_path)} --force" ) # Assert - export_path = tmp_path / f"{notebook.display_name}.Notebook" + export_path = tmp_path / f"{item.display_name}.{item_type.value}" assert export_path.is_dir() files = list(export_path.iterdir()) assert len(files) == 2 - assert any(file.suffix == ".ipynb" for file in files) + assert any(file.suffix == expected_file_extension for file in files) assert any(file.name == ".platform" for file in files) mock_print_done.assert_called_once() mock_print_warning.assert_called_once() + @pytest.mark.parametrize("item_type,expected_file_extension", [ + (ItemType.NOTEBOOK, ".ipynb"), + (ItemType.SPARK_JOB_DEFINITION, ".json"), + (ItemType.DATA_PIPELINE, ".json"), + (ItemType.MIRRORED_DATABASE, ".json") + ]) def test_export_item_home_directory_path_success( self, item_factory, @@ -48,13 +64,15 @@ def test_export_item_home_directory_path_success( tmp_path, monkeypatch, mock_print_warning, + item_type, + expected_file_extension, ): # Setup home_dir = tmp_path / "home" home_dir.mkdir() home_dir_env = "USERPROFILE" if platform.system() == "Windows" else "HOME" monkeypatch.setenv(home_dir_env, str(home_dir)) - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) output_dir = home_dir / "test_export" output_dir.mkdir() @@ -64,31 +82,40 @@ def test_export_item_home_directory_path_success( # Execute command using ~/path notation cli_executor.exec_command( - f"export {notebook.full_path} --output ~/test_export --force" + f"export {item.full_path} --output ~/test_export --force" ) # Assert - export_path = output_dir / f"{notebook.display_name}.Notebook" + export_path = output_dir / f"{item.display_name}.{item_type.value}" assert export_path.is_dir() files = list(export_path.iterdir()) assert len(files) == 2 - assert any(file.suffix == ".ipynb" for file in files) + assert any(file.suffix == expected_file_extension for file in files) assert any(file.name == ".platform" for file in files) mock_print_done.assert_called_once() mock_print_warning.assert_called_once() + @pytest.mark.parametrize("item_type", [ + ItemType.NOTEBOOK, + ItemType.SPARK_JOB_DEFINITION, + ItemType.DATA_PIPELINE, + ItemType.MIRRORED_DATABASE, + ItemType.REPORT, + ItemType.SEMANTIC_MODEL, + ItemType.KQL_DATABASE + ]) def test_export_item_invalid_output_path_failure( - self, item_factory, cli_executor, mock_print_done, assert_fabric_cli_error + self, item_factory, cli_executor, mock_print_done, assert_fabric_cli_error, item_type ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command cli_executor.exec_command( - f"export {notebook.full_path} --output /invalid/path --force" + f"export {item.full_path} --output /invalid/path --force" ) # Assert @@ -183,93 +210,97 @@ def test_export_workspace_with_no_items_supporting_export_failure( # Assert assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) - def test_export_notebook_py_format_success( - self, item_factory, cli_executor, mock_print_done, tmp_path + @pytest.mark.parametrize("item_type,export_format,expected_file_extension", [ + (ItemType.NOTEBOOK, ".py", ".py"), + (ItemType.NOTEBOOK, ".ipynb", ".ipynb") + ]) + def test_export_item_format_success( + self, item_factory, cli_executor, mock_print_done, tmp_path, + item_type, export_format, expected_file_extension ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command cli_executor.exec_command( - f"export {notebook.full_path} --output {str(tmp_path)} --format .py --force" + f"export {item.full_path} --output {str(tmp_path)} --format {export_format} --force" ) # Assert - export_path = tmp_path / f"{notebook.display_name}.Notebook" + export_path = tmp_path / f"{item.display_name}.{item_type.value}" assert export_path.is_dir() files = list(export_path.iterdir()) assert len(files) == 2 - assert any(file.suffix == ".py" for file in files) + assert any(file.suffix == expected_file_extension for file in files) assert any(file.name == ".platform" for file in files) mock_print_done.assert_called_once() - def test_export_notebook_default_format_success( - self, item_factory, cli_executor, mock_print_done, tmp_path + @pytest.mark.parametrize("item_type,expected_default_extension", [ + (ItemType.NOTEBOOK, ".ipynb"), # Default format for notebook is ipynb + (ItemType.SPARK_JOB_DEFINITION, ".json"), + (ItemType.DATA_PIPELINE, ".json"), + (ItemType.MIRRORED_DATABASE, ".json"), + (ItemType.REPORT, ".pbix"), + (ItemType.SEMANTIC_MODEL, ".json"), + (ItemType.KQL_DATABASE, ".json"), + (ItemType.LAKEHOUSE, ".json"), + (ItemType.WAREHOUSE, ".json"), + ]) + def test_export_item_default_format_success( + self, item_factory, cli_executor, mock_print_done, tmp_path, + item_type, expected_default_extension ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command without format (should use default format from definition_format_mapping) cli_executor.exec_command( - f"export {notebook.full_path} --output {str(tmp_path)} --force" + f"export {item.full_path} --output {str(tmp_path)} --force" ) - # Assert - should use default format which is "?format=ipynb" resulting in .ipynb file - export_path = tmp_path / f"{notebook.display_name}.Notebook" + # Assert - should use default format for each item type + export_path = tmp_path / f"{item.display_name}.{item_type.value}" assert export_path.is_dir() files = list(export_path.iterdir()) assert len(files) == 2 - assert any(file.suffix == ".ipynb" for file in files) # Default format should be .ipynb + assert any(file.suffix == expected_default_extension for file in files) assert any(file.name == ".platform" for file in files) mock_print_done.assert_called_once() - def test_export_notebook_invalid_format_failure( + @pytest.mark.parametrize("item_type,invalid_format,expected_error_suffix", [ + (ItemType.NOTEBOOK, ".txt", "Only the following formats are supported: .py, .ipynb"), + (ItemType.SPARK_JOB_DEFINITION, ".txt", "Only the following formats are supported: "), + (ItemType.DATA_PIPELINE, ".txt", "No formats are supported"), + (ItemType.MIRRORED_DATABASE, ".txt", "No formats are supported") + ]) + def test_export_item_invalid_format_failure( self, item_factory, cli_executor, assert_fabric_cli_error, mock_print_done, tmp_path, + item_type, + invalid_format, + expected_error_suffix, ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) + item = item_factory(item_type) # Reset mock mock_print_done.reset_mock() # Execute command cli_executor.exec_command( - f"export {notebook.full_path} --output {str(tmp_path)} --format .txt --force" + f"export {item.full_path} --output {str(tmp_path)} --format {invalid_format} --force" ) # Assert - assert_fabric_cli_error(constant.ERROR_INVALID_INPUT, "Invalid format. Only the following formats are supported: .py, .ipynb") - - def test_export_report_no_format_support_failure( - self, - item_factory, - cli_executor, - assert_fabric_cli_error, - mock_print_done, - tmp_path, - ): - # Setup - report = item_factory(ItemType.REPORT) - - # Reset mock - mock_print_done.reset_mock() - - # Execute command - Report doesn't have any format support in definition_format_mapping - cli_executor.exec_command( - f"export {report.full_path} --output {str(tmp_path)} --format .txt --force" - ) - - # Assert - should fail with error indicating no formats are supported - assert_fabric_cli_error(constant.ERROR_INVALID_INPUT, "No formats are supported") + assert_fabric_cli_error(constant.ERROR_INVALID_INPUT, f"Invalid format. {expected_error_suffix}") \ No newline at end of file diff --git a/tests/test_commands/test_get.py b/tests/test_commands/test_get.py index 16ed083c..71b7eb42 100644 --- a/tests/test_commands/test_get.py +++ b/tests/test_commands/test_get.py @@ -5,6 +5,8 @@ import json import time +import pytest + import fabric_cli.commands.fs.fab_fs_get as fab_get import fabric_cli.commands.fs.fab_fs_ln as fab_ln from fabric_cli.core import fab_constant @@ -19,6 +21,7 @@ from tests.test_commands.conftest import assert_fabric_cli_error from tests.test_commands.data.static_test_data import StaticTestData from tests.test_commands.utils import cli_path_join +from tests.test_commands.conftest import basic_item_parametrize, custom_parametrize class TestGet: @@ -73,82 +76,88 @@ def test_get_workspace_query_displayName_success( # endregion # region Item - def test_get_item_lakehouse_query_all_success( - self, item_factory, cli_executor, mock_questionary_print, mock_print_warning + @custom_parametrize + def test_get_item_query_all_success( + self, item_factory, cli_executor, mock_questionary_print, mock_print_warning, item_type ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + item = item_factory(item_type) # Reset mock mock_questionary_print.reset_mock() mock_print_warning.reset_mock() # Execute command - cli_executor.exec_command(f"get {lakehouse.full_path} --query . --force") + cli_executor.exec_command(f"get {item.full_path} --query . --force") # Assert mock_questionary_print.assert_called_once() - mock_print_warning.assert_not_called() # lakehouse item is called with get item and not get item with definition - assert lakehouse.display_name in mock_questionary_print.call_args[0][0] - - # Assert lakehouse extended properties are returned - assert "properties" in mock_questionary_print.call_args[0][0] - assert "oneLakeTablesPath" in mock_questionary_print.call_args[0][0] - assert "oneLakeFilesPath" in mock_questionary_print.call_args[0][0] - assert "sqlEndpointProperties" in mock_questionary_print.call_args[0][0] - - def test_get_item_environment_success( - self, item_factory, cli_executor, mock_questionary_print, mock_print_warning + assert item.display_name in mock_questionary_print.call_args[0][0] + + # Assert basic item properties are returned + assert "id" in mock_questionary_print.call_args[0][0] + assert "displayName" in mock_questionary_print.call_args[0][0] + assert "type" in mock_questionary_print.call_args[0][0] + + @pytest.mark.parametrize("item_type,expected_properties", [ + (ItemType.ENVIRONMENT, ["properties", "publishDetails", "connections", "published", "staging"]), + (ItemType.LAKEHOUSE, ["properties", "oneLakeTablesPath", "oneLakeFilesPath", "sqlEndpointProperties"]), + (ItemType.WAREHOUSE, ["properties"]), + (ItemType.KQL_DATABASE, ["properties"]), + (ItemType.SQL_DATABASE, ["properties"]), + (ItemType.MIRRORED_DATABASE, ["definition", "connections", "status", "tablesStatus"]), + ]) + def test_get_item_with_properties_success( + self, item_factory, cli_executor, mock_questionary_print, mock_print_warning, item_type, expected_properties ): # Setup - environment = item_factory(ItemType.ENVIRONMENT) + item = item_factory(item_type) # Reset mock mock_questionary_print.reset_mock() mock_print_warning.reset_mock() # Execute command - cli_executor.exec_command(f"get {environment.full_path} --query . --force") + cli_executor.exec_command(f"get {item.full_path} --query . --force") # Assert mock_questionary_print.assert_called_once() - mock_print_warning.assert_not_called() # enironment item is called with get item and not get item with definition - assert environment.display_name in mock_questionary_print.call_args[0][0] - - # Assert enviroment extended properties are returned - assert "properties" in mock_questionary_print.call_args[0][0] - assert "publishDetails" in mock_questionary_print.call_args[0][0] - - # Assert environment metadata is returned - assert "connections" in mock_questionary_print.call_args[0][0] - assert "published" in mock_questionary_print.call_args[0][0] - assert "staging" in mock_questionary_print.call_args[0][0] - - def test_get_item_mirroreddb_success( - self, item_factory, cli_executor, mock_questionary_print, mock_print_warning + assert item.display_name in mock_questionary_print.call_args[0][0] + + # Assert specific properties for this item type + for prop in expected_properties: + assert prop in mock_questionary_print.call_args[0][0] + + @pytest.mark.parametrize("item_type,expects_warning", [ + (ItemType.MIRRORED_DATABASE, True), # Called with get item with definition + (ItemType.NOTEBOOK, True), # Items with definition typically trigger warnings + (ItemType.DATA_PIPELINE, True), # Items with definition typically trigger warnings + (ItemType.LAKEHOUSE, False), # Called with get item, not get item with definition + (ItemType.ENVIRONMENT, False), # Called with get item, not get item with definition + (ItemType.WAREHOUSE, False), # Called with get item, not get item with definition + ]) + def test_get_item_warning_behavior_success( + self, item_factory, cli_executor, mock_questionary_print, mock_print_warning, item_type, expects_warning ): # Setup - mirroreddb = item_factory(ItemType.MIRRORED_DATABASE) + item = item_factory(item_type) # Reset mock mock_questionary_print.reset_mock() mock_print_warning.reset_mock() # Execute command - cli_executor.exec_command(f"get {mirroreddb.full_path} --query . --force") + cli_executor.exec_command(f"get {item.full_path} --query . --force") # Assert mock_questionary_print.assert_called_once() - mock_print_warning.assert_called_once() # MIRRORED_DATABASE is called with get item with definition - assert mirroreddb.display_name in mock_questionary_print.call_args[0][0] - - # Assert mirroreddb definition is returned - assert "definition" in mock_questionary_print.call_args[0][0] - - # Assert mirroreddb metadata is returned - assert "connections" in mock_questionary_print.call_args[0][0] - assert "status" in mock_questionary_print.call_args[0][0] - assert "tablesStatus" in mock_questionary_print.call_args[0][0] + assert item.display_name in mock_questionary_print.call_args[0][0] + + # Assert warning behavior based on item type + if expects_warning: + mock_print_warning.assert_called_once() # Items with definition trigger warnings + else: + mock_print_warning.assert_not_called() # Items without definition don't trigger warnings # endregion @@ -220,26 +229,34 @@ def test_get_virtual_workspace_capacity_query_all_success( for call in mock_questionary_print.mock_calls ) - def test_get_virtual_workspace_domain_success( - self, virtual_workspace_item_factory, cli_executor, mock_questionary_print + @pytest.mark.parametrize("virtual_workspace_type,expected_properties", [ + (VirtualWorkspaceType.DOMAIN, ["contributorsScope", "domainWorkspaces"]), + (VirtualWorkspaceType.GATEWAY, ["type", "version"]), + ]) + def test_get_virtual_workspace_success( + self, virtual_workspace_item_factory, cli_executor, mock_questionary_print, + virtual_workspace_type, expected_properties ): # Setup - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) + virtual_workspace = virtual_workspace_item_factory(virtual_workspace_type) # Reset mock mock_questionary_print.reset_mock() # Execute command - cli_executor.exec_command(f"get {domain.full_path} --query .") + cli_executor.exec_command(f"get {virtual_workspace.full_path} --query .") # Assert mock_questionary_print.assert_called_once() - assert domain.display_name in mock_questionary_print.call_args[0][0] - - # Assert domain metadata is returned - assert "parentDomainId" not in mock_questionary_print.call_args[0][0] - assert "contributorsScope" in mock_questionary_print.call_args[0][0] - assert "domainWorkspaces" in mock_questionary_print.call_args[0][0] + assert virtual_workspace.display_name in mock_questionary_print.call_args[0][0] + + # Assert specific properties for this virtual workspace type + for prop in expected_properties: + assert prop in mock_questionary_print.call_args[0][0] + + # Domain-specific assertion (parentDomainId should not be present) + if virtual_workspace_type == VirtualWorkspaceType.DOMAIN: + assert "parentDomainId" not in mock_questionary_print.call_args[0][0] # endregion diff --git a/tests/test_commands/test_import.py b/tests/test_commands/test_import.py index 674a6ea4..d3397d66 100644 --- a/tests/test_commands/test_import.py +++ b/tests/test_commands/test_import.py @@ -14,15 +14,18 @@ from fabric_cli.core import fab_handle_context as handle_context from fabric_cli.core.fab_types import ItemType from tests.test_commands.commands_parser import CLIExecutor +from tests.test_commands.conftest import basic_item_parametrize from tests.test_commands.utils import cli_path_join new_name_index = 1 class TestImport: - # Update existing tests - def test_import_update_existing_notebook_item_success( + # region Parametrized Tests + @basic_item_parametrize + def test_import_update_existing_item_success( self, + item_type, item_factory, mock_print_done, tmp_path, @@ -40,239 +43,68 @@ def test_import_update_existing_notebook_item_success( spy_update_item_definition, mock_print_grey, upsert_item_to_cache, - ItemType.NOTEBOOK, - cli_executor, - ) - - def test_import_update_existing_sjd_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.SPARK_JOB_DEFINITION, - cli_executor, - ) - - def test_import_update_existing_data_pipeline_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.DATA_PIPELINE, - cli_executor, - ) - - def test_import_update_existing_report_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.REPORT, - cli_executor, - ) - - def test_import_update_existing_semantic_model_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.SEMANTIC_MODEL, - cli_executor, - ) - - def test_import_update_existing_kql_db_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_DATABASE, - cli_executor, - ) - - def test_import_update_existing_kql_qs_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_QUERYSET, - cli_executor, - ) - - def test_import_update_existing_eventhouse_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.EVENTHOUSE, + item_type, cli_executor, ) - def test_import_update_existing_mirrored_db_item_success( + @pytest.mark.parametrize("item_type", [ + ItemType.NOTEBOOK, ItemType.SPARK_JOB_DEFINITION, ItemType.DATA_PIPELINE, + ItemType.REPORT, ItemType.SEMANTIC_MODEL, ItemType.KQL_DATABASE, + ItemType.KQL_QUERYSET, ItemType.EVENTHOUSE, ItemType.MIRRORED_DATABASE, + ItemType.REFLEX, ItemType.KQL_DASHBOARD, ItemType.SQL_DATABASE, + ]) + def test_import_create_new_item_success( self, + item_type, item_factory, mock_print_done, tmp_path, - mock_print_warning, - spy_update_item_definition, + spy_create_item, mock_print_grey, upsert_item_to_cache, - cli_executor: CLIExecutor, + cli_executor, ): - _import_update_existing_item_success( + _import_create_new_item_success( item_factory, mock_print_done, tmp_path, - mock_print_warning, - spy_update_item_definition, + spy_create_item, mock_print_grey, upsert_item_to_cache, - ItemType.MIRRORED_DATABASE, + item_type, cli_executor, ) - def test_import_update_existing_reflex_item_success( + @pytest.mark.parametrize("item_type", [ + ItemType.DASHBOARD, ItemType.DATAMART, ItemType.LAKEHOUSE, + ItemType.MIRRORED_WAREHOUSE, ItemType.ML_EXPERIMENT, ItemType.ML_MODEL, + ItemType.PAGINATED_REPORT, ItemType.SQL_ENDPOINT, ItemType.WAREHOUSE, + ]) + def test_import_create_new_item_fail( self, - item_factory, + item_type, + workspace, mock_print_done, tmp_path, - mock_print_warning, - spy_update_item_definition, + spy_create_item, mock_print_grey, upsert_item_to_cache, - cli_executor: CLIExecutor, + cli_executor, + assert_fabric_cli_error, ): - _import_update_existing_item_success( - item_factory, + _import_create_new_item_fail( + workspace, mock_print_done, tmp_path, - mock_print_warning, - spy_update_item_definition, + spy_create_item, mock_print_grey, upsert_item_to_cache, - ItemType.REFLEX, + item_type, cli_executor, + assert_fabric_cli_error, ) - def test_import_update_existing_kql_dashboard_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - cli_executor: CLIExecutor, - ): - _import_update_existing_item_success( - item_factory, - mock_print_done, - tmp_path, - mock_print_warning, - spy_update_item_definition, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_DASHBOARD, - cli_executor, - ) + # endregion # Create new tests def test_import_home_directory_path_success( @@ -307,466 +139,6 @@ def test_import_home_directory_path_success( cli_executor, ) - def test_import_create_new_sqldb_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.SQL_DATABASE, - cli_executor, - ) - - def test_import_create_new_notebook_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.NOTEBOOK, - cli_executor, - ) - - def test_import_create_new_sjd_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.SPARK_JOB_DEFINITION, - cli_executor, - ) - - def test_import_create_new_data_pipeline_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.DATA_PIPELINE, - cli_executor, - ) - - def test_import_create_new_report_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.REPORT, - cli_executor, - ) - - def test_import_create_new_semantic_model_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.SEMANTIC_MODEL, - cli_executor, - ) - - def test_import_create_new_kql_db_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_DATABASE, - cli_executor, - ) - - def test_import_create_new_kql_qs_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_QUERYSET, - cli_executor, - ) - - def test_import_create_new_eventhouse_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.EVENTHOUSE, - cli_executor, - ) - - def test_import_create_new_mirrored_db_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.MIRRORED_DATABASE, - cli_executor, - ) - - def test_import_create_new_reflex_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.REFLEX, - cli_executor, - ) - - def test_import_create_new_kql_dashboard_item_success( - self, - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - ): - _import_create_new_item_success( - item_factory, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.KQL_DASHBOARD, - cli_executor, - ) - - # Non Supported items tests - def test_import_create_new_dashboard_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.DASHBOARD, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_datamart_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.DATAMART, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_lakehouse_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.LAKEHOUSE, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_mirrored_warehouse_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.MIRRORED_WAREHOUSE, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_ml_experiment_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.ML_EXPERIMENT, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_ml_model_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.ML_MODEL, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_paginated_report_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.PAGINATED_REPORT, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_sql_endpoint_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.SQL_ENDPOINT, - cli_executor, - assert_fabric_cli_error, - ) - - def test_import_create_new_warehouse_item_fail( - self, - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - cli_executor, - assert_fabric_cli_error, - ): - _import_create_new_item_fail( - workspace, - mock_print_done, - tmp_path, - spy_create_item, - mock_print_grey, - upsert_item_to_cache, - ItemType.WAREHOUSE, - cli_executor, - assert_fabric_cli_error, - ) - # Test with lakehouse path def test_import_lakehouse_path_fail( self, diff --git a/tests/test_commands/test_ls.py b/tests/test_commands/test_ls.py index dfef0bc5..53c9d921 100644 --- a/tests/test_commands/test_ls.py +++ b/tests/test_commands/test_ls.py @@ -20,10 +20,10 @@ from tests.test_commands.commands_parser import CLIExecutor from tests.test_commands.data.static_test_data import StaticTestData from tests.test_commands.utils import cli_path_join +from tests.test_commands.conftest import basic_item_parametrize, custom_parametrize class TestLS: - _workspace_long_columns = [ "name", "id", @@ -98,6 +98,8 @@ class TestLS: ] # region ITEM + + @custom_parametrize @pytest.mark.parametrize("command", ["ls", "dir"]) def test_ls_workspace_items_success( self, @@ -105,12 +107,11 @@ def test_ls_workspace_items_success( item_factory, mock_questionary_print, command, + item_type, cli_executor: CLIExecutor, ): - # Setup 3 items - notebook = item_factory(ItemType.NOTEBOOK) - lakehouse = item_factory(ItemType.LAKEHOUSE) - data_pipeline = item_factory(ItemType.DATA_PIPELINE) + # Setup item of parametrized type + item = item_factory(item_type) # Test 1: without args cli_executor.exec_command(f"{command} {workspace.full_path}") @@ -118,7 +119,7 @@ def test_ls_workspace_items_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -137,7 +138,7 @@ def test_ls_workspace_items_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -159,7 +160,7 @@ def test_ls_workspace_items_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -178,7 +179,7 @@ def test_ls_workspace_items_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -192,24 +193,26 @@ def test_ls_workspace_items_success( self._virtual_workspace_items, True, mock_questionary_print.mock_calls ) + @basic_item_parametrize def test_ls_query_filter_success( self, workspace, item_factory, mock_questionary_print, assert_fabric_cli_error, + item_type, cli_executor: CLIExecutor, ): - # Setup items with different names and types - notebook1 = item_factory(ItemType.NOTEBOOK) - notebook2 = item_factory(ItemType.NOTEBOOK) - notebook3 = item_factory(ItemType.NOTEBOOK) + # Setup items with different names and same parametrized type + item1 = item_factory(item_type) + item2 = item_factory(item_type) + item3 = item_factory(item_type) # Test 1: Basic JMESPath syntax cli_executor.exec_command(f'ls {workspace.full_path} -q [].name') mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook1.display_name, notebook2.display_name, notebook3.display_name], + [item1.display_name, item2.display_name, item3.display_name], True, mock_questionary_print.mock_calls, ) @@ -222,7 +225,7 @@ def test_ls_query_filter_success( ) mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook1.display_name, notebook2.display_name, notebook3.display_name], + [item1.display_name, item2.display_name, item3.display_name], True, mock_questionary_print.mock_calls, ) @@ -239,7 +242,7 @@ def test_ls_query_filter_success( # Test 3: JMESPath list syntax - here there are not keys so will be printed as list of arrays cli_executor.exec_command(f'ls {workspace.full_path} -q [].[name]') _assert_strings_in_mock_calls( - [f"['{notebook1.name}']", f"['{notebook2.name}']", f"['{notebook3.name}']"], + [f"['{item1.name}']", f"['{item2.name}']", f"['{item3.name}']"], True, mock_questionary_print.mock_calls, ) @@ -250,7 +253,7 @@ def test_ls_query_filter_success( cli_executor.exec_command(f'ls {workspace.full_path} -q "[].{{displayName: name, itemId: id}}"') mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [f'{notebook1.name} None', f'{notebook2.name} None', f'{notebook3.name} None'], + [f'{item1.name} None', f'{item2.name} None', f'{item3.name} None'], True, mock_questionary_print.mock_calls, ) @@ -259,17 +262,17 @@ def test_ls_query_filter_success( # Test 5: JMESPath query filters specific value cli_executor.exec_command( - f"ls {workspace.full_path} -q \"[?name=='{notebook1.name}'].name\"" + f"ls {workspace.full_path} -q \"[?name=='{item1.name}'].name\"" ) mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [f'{notebook1.name}'], + [f'{item1.name}'], True, mock_questionary_print.mock_calls, ) _assert_strings_in_mock_calls( - [f'{notebook2.name}', f'{notebook3.name}'], + [f'{item2.name}', f'{item3.name}'], False, mock_questionary_print.mock_calls, ) @@ -547,20 +550,26 @@ def test_ls_workspaces_json_format_success( # endregion # region ITEM FOLDERS + @pytest.mark.parametrize("item_type,expected_folders", [ + (ItemType.LAKEHOUSE, ["Files", "Tables", "TableMaintenance"]), + (ItemType.WAREHOUSE, ["Files", "Tables"]), + (ItemType.SPARK_JOB_DEFINITION, ["Libs", "Main", "Snapshots"]), + (ItemType.KQL_DATABASE, ["Tables", "Shortcut"]), + (ItemType.SQL_DATABASE, ["Tables", "Files", "Code"]), + ]) def test_ls_item_folders_success( - self, item_factory, mock_questionary_print, cli_executor: CLIExecutor + self, item_factory, mock_questionary_print, item_type, expected_folders, cli_executor: CLIExecutor ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) - expected_output = ["Files", "Tables", "TableMaintenance"] + item = item_factory(item_type) # Test 1: without args - cli_executor.exec_command(f"ls {lakehouse.full_path}") + cli_executor.exec_command(f"ls {item.full_path}") # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - expected_output, True, mock_questionary_print.mock_calls + expected_folders, True, mock_questionary_print.mock_calls ) _assert_strings_in_mock_calls( self._item_folders_long_columns, False, mock_questionary_print.mock_calls @@ -569,12 +578,12 @@ def test_ls_item_folders_success( mock_questionary_print.reset_mock() # Test 2: with long - cli_executor.exec_command(f"ls {lakehouse.full_path} --long") + cli_executor.exec_command(f"ls {item.full_path} --long") # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - expected_output, True, mock_questionary_print.mock_calls + expected_folders, True, mock_questionary_print.mock_calls ) _assert_strings_in_mock_calls( self._item_folders_long_columns, True, mock_questionary_print.mock_calls @@ -1088,21 +1097,29 @@ def test_ls_subfolder_success( require_all_in_same_args=True, ) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, + ItemType.ENVIRONMENT, ItemType.EVENTHOUSE, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.LAKEHOUSE, ItemType.ML_EXPERIMENT, ItemType.ML_MODEL, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.GRAPHQLAPI, + ItemType.SQL_DATABASE, ItemType.SEMANTIC_MODEL, + ItemType.SPARK_JOB_DEFINITION, ItemType.WAREHOUSE, ItemType.COPYJOB, + ]) def test_ls_folder_content_success( self, - workspace, folder_factory, item_factory, mock_questionary_print, + item_type, cli_executor: CLIExecutor, ): # Setup folder = folder_factory() - # Setup 3 items - notebook = item_factory(ItemType.NOTEBOOK, path=folder.full_path) - lakehouse = item_factory(ItemType.LAKEHOUSE, path=folder.full_path) - data_pipeline = item_factory(ItemType.DATA_PIPELINE, path=folder.full_path) + # Setup item of parametrized type + item = item_factory(item_type, path=folder.full_path) # Test 1: without args cli_executor.exec_command(f"ls {folder.full_path}") @@ -1110,7 +1127,7 @@ def test_ls_folder_content_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -1126,7 +1143,7 @@ def test_ls_folder_content_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -1145,7 +1162,7 @@ def test_ls_folder_content_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -1161,7 +1178,7 @@ def test_ls_folder_content_success( # Assert mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [item.display_name], True, mock_questionary_print.mock_calls, ) @@ -1172,29 +1189,39 @@ def test_ls_folder_content_success( require_all_in_same_args=True, ) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, + ItemType.ENVIRONMENT, ItemType.EVENTHOUSE, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.LAKEHOUSE, ItemType.ML_EXPERIMENT, ItemType.ML_MODEL, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.GRAPHQLAPI, + ItemType.SQL_DATABASE, ItemType.SEMANTIC_MODEL, + ItemType.SPARK_JOB_DEFINITION, ItemType.WAREHOUSE, ItemType.COPYJOB, + ]) def test_ls_workspace_items_no_list_folders_support_success( self, workspace, folder_factory, item_factory, mock_questionary_print, + item_type, cli_executor: CLIExecutor, ): # Setup folder = folder_factory() - # Setup 3 items - notebook = item_factory(ItemType.NOTEBOOK) - lakehouse = item_factory(ItemType.LAKEHOUSE, path=folder.full_path) - data_pipeline = item_factory(ItemType.DATA_PIPELINE, path=folder.full_path) + # Setup 2 items of the same parametrized type - one in workspace, one in folder + workspace_item = item_factory(item_type) + folder_item = item_factory(item_type, path=folder.full_path) # Test 1: workspace ls cli_executor.exec_command(f"ls {workspace.full_path}") - # Assert that only the notebook and folder are listed + # Assert that only the workspace item and folder are listed mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, folder.display_name], + [workspace_item.display_name, folder.display_name], True, mock_questionary_print.mock_calls, ) @@ -1207,10 +1234,10 @@ def test_ls_workspace_items_no_list_folders_support_success( # Test 2: Folder ls cli_executor.exec_command(f"ls {folder.full_path}") - # Assert that only the lakehouse and data pipeline are listed + # Assert that only the folder item is listed mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [lakehouse.display_name, data_pipeline.display_name], + [folder_item.display_name], True, mock_questionary_print.mock_calls, ) @@ -1226,10 +1253,10 @@ def test_ls_workspace_items_no_list_folders_support_success( # Test 3: workspace ls cli_executor.exec_command(f"ls {workspace.full_path}") - # Assert that only the items are listed + # Assert that both items are listed (folder and its contents flattened) mock_questionary_print.assert_called() _assert_strings_in_mock_calls( - [notebook.display_name, lakehouse.display_name, data_pipeline.display_name], + [workspace_item.display_name, folder_item.display_name], True, mock_questionary_print.mock_calls, ) diff --git a/tests/test_commands/test_mkdir.py b/tests/test_commands/test_mkdir.py index e7f1de8e..eb320000 100644 --- a/tests/test_commands/test_mkdir.py +++ b/tests/test_commands/test_mkdir.py @@ -29,7 +29,7 @@ VirtualWorkspaceType, ) from fabric_cli.errors import ErrorMessages -from tests.test_commands.conftest import mock_print_done +from tests.test_commands.conftest import custom_parametrize from tests.test_commands.data.models import EntityMetadata from tests.test_commands.data.static_test_data import StaticTestData from tests.test_commands.processors import generate_random_string @@ -38,20 +38,61 @@ class TestMkdir: # region ITEM + + @custom_parametrize def test_mkdir_item_name_already_exists_failure( - self, item_factory, cli_executor, assert_fabric_cli_error + self, item_type, item_factory, cli_executor, assert_fabric_cli_error ): # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) + created_factory = item_factory(item_type) # Execute command - cli_executor.exec_command(f"mkdir {lakehouse.full_path}") + cli_executor.exec_command(f"mkdir {created_factory.full_path}") # Assert assert_fabric_cli_error(constant.ERROR_ALREADY_EXISTS) + @custom_parametrize + def test_mkdir_item_success( + self, + item_type, + workspace, + cli_executor, + mock_print_done, + mock_questionary_print, + vcr_instance, + cassette_name, + ): + # Setup + item_display_name = generate_random_string(vcr_instance, cassette_name) + item_full_path = cli_path_join( + workspace.full_path, f"{item_display_name}.{item_type}" + ) + + # Execute command + cli_executor.exec_command(f"mkdir {item_full_path}") + + # Assert + mock_print_done.assert_called_once() + assert item_display_name in mock_print_done.call_args[0][0] + mock_questionary_print.reset_mock() + get(item_full_path, query=".") + mock_questionary_print.assert_called_once() + assert item_display_name in mock_questionary_print.call_args[0][0] + + # Cleanup + rm(item_full_path) + + @pytest.mark.parametrize("unsupported_item_type", [ + ItemType.DASHBOARD, + ItemType.DATAMART, + ItemType.MIRRORED_WAREHOUSE, + ItemType.PAGINATED_REPORT, + ItemType.SQL_ENDPOINT, + ]) def test_mkdir_unsupported_item_failure( self, + unsupported_item_type, workspace_factory, cli_executor, assert_fabric_cli_error, @@ -60,24 +101,21 @@ def test_mkdir_unsupported_item_failure( ): workspace = workspace_factory() - # Create paginatedReport - paginatedReport_display_name = generate_random_string( + # Create unsupported item + item_display_name = generate_random_string( vcr_instance, cassette_name ) - paginatedReport_name = ( - f"{paginatedReport_display_name}.{ItemType.PAGINATED_REPORT}" - ) - paginatedReport_full_path = cli_path_join( - workspace.full_path, paginatedReport_name - ) - paginatedReport = EntityMetadata( - paginatedReport_display_name, - paginatedReport_name, - paginatedReport_full_path, + item_name = f"{item_display_name}.{unsupported_item_type}" + item_full_path = cli_path_join(workspace.full_path, item_name) + + unsupported_item = EntityMetadata( + item_display_name, + item_name, + item_full_path, ) # Execute command - cli_executor.exec_command(f"mkdir {paginatedReport.full_path}") + cli_executor.exec_command(f"mkdir {unsupported_item.full_path}") # Assert assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) @@ -201,6 +239,109 @@ def test_mkdir_kqldatabase_without_creation_payload_success( # Cleanup - removing parent eventhouse removes the kqldatabase as well rm(eventhouse_full_path) + @pytest.mark.parametrize("item_type,params,expected_assertions", [ + (ItemType.LAKEHOUSE, "enableSchemas=true", ["defaultSchema"]), + (ItemType.WAREHOUSE, "enableCaseInsensitive=true", ["Latin1_General_100_CI_AS_KS_WS_SC_UTF8"]), + (ItemType.WAREHOUSE, "", ["Latin1_General_100_BIN2_UTF8"]), + (ItemType.REPORT, "", ["_auto"]), + ]) + def test_mkdir_item_with_creation_payload_success( + self, + item_type, + params, + expected_assertions, + workspace, + cli_executor, + mock_print_done, + mock_questionary_print, + vcr_instance, + cassette_name, + ): + # Setup + item_display_name = generate_random_string(vcr_instance, cassette_name) + item_full_path = cli_path_join( + workspace.full_path, f"{item_display_name}.{item_type}" + ) + + # Execute command + if params: + cli_executor.exec_command(f"mkdir {item_full_path} -P {params}") + else: + cli_executor.exec_command(f"mkdir {item_full_path}") + + # Assert creation success + mock_print_done.assert_called() + assert item_display_name in mock_print_done.call_args[0][0] + + # Verify item was created with expected configuration + mock_questionary_print.reset_mock() + get(item_full_path, query=".") + mock_questionary_print.assert_called_once() + + result_output = mock_questionary_print.call_args[0][0] + assert item_display_name in result_output + + # Check type-specific assertions + for assertion in expected_assertions: + assert assertion in result_output + + # Cleanup + rm(item_full_path) + + def test_mkdir_mounted_data_factory_with_required_params_success( + self, + workspace, + cli_executor, + mock_print_done, + mock_questionary_print, + vcr_instance, + cassette_name, + test_data: StaticTestData, + ): + # Setup + mdf_display_name = generate_random_string(vcr_instance, cassette_name) + mdf_full_path = cli_path_join( + workspace.full_path, f"{mdf_display_name}.{ItemType.MOUNTED_DATA_FACTORY}" + ) + + # Execute command with required params + cli_executor.exec_command( + f"mkdir {mdf_full_path} -P subscriptionId={test_data.azure_subscription_id},resourceGroup={test_data.azure_resource_group},factoryName=test-factory-name" + ) + + # Assert creation success + mock_print_done.assert_called() + assert mdf_display_name in mock_print_done.call_args[0][0] + + # Verify item was created + mock_questionary_print.reset_mock() + get(mdf_full_path, query=".") + mock_questionary_print.assert_called_once() + assert mdf_display_name in mock_questionary_print.call_args[0][0] + + # Cleanup + rm(mdf_full_path) + + def test_mkdir_mounted_data_factory_missing_required_params_failure( + self, + workspace, + cli_executor, + assert_fabric_cli_error, + vcr_instance, + cassette_name, + ): + # Setup + mdf_display_name = generate_random_string(vcr_instance, cassette_name) + mdf_full_path = cli_path_join( + workspace.full_path, f"{mdf_display_name}.{ItemType.MOUNTED_DATA_FACTORY}" + ) + + # Execute command without required params + cli_executor.exec_command(f"mkdir {mdf_full_path}") + + # Assert failure due to missing required params + assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) + # endregion # region WORKSPACE diff --git a/tests/test_commands/test_mv.py b/tests/test_commands/test_mv.py index 5563ff6b..1dbdcef8 100644 --- a/tests/test_commands/test_mv.py +++ b/tests/test_commands/test_mv.py @@ -3,6 +3,7 @@ import argparse from unittest.mock import patch +import pytest import fabric_cli.commands.fs.fab_fs_ln as fab_ln import fabric_cli.commands.fs.fab_fs_ls as fab_ls @@ -11,7 +12,7 @@ from fabric_cli.core.fab_types import ItemType, VirtualWorkspaceType, VirtualItemContainerType from fabric_cli.core.hiearchy.fab_onelake_element import OneLakeItem from tests.test_commands.commands_parser import CLIExecutor -from tests.test_commands.conftest import mkdir +from tests.test_commands.conftest import basic_item_parametrize, mkdir from tests.test_commands.data.models import EntityMetadata from tests.test_commands.utils import cli_path_join @@ -187,6 +188,11 @@ def test_mv_workspace_to_workspace_recursive_success( sjd.name in call.args[0] for call in mock_questionary_print.mock_calls ) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, + ]) def test_mv_item_to_item_success( self, workspace_factory, @@ -195,11 +201,12 @@ def test_mv_item_to_item_success( mock_questionary_print, cli_executor: CLIExecutor, mock_print_warning, + item_type, ): # Setup ws1 = workspace_factory() ws2 = workspace_factory() - notebook = item_factory(ItemType.NOTEBOOK, ws1.full_path) + item = item_factory(item_type, ws1.full_path) # Reset mock mock_print_done.reset_mock() @@ -210,11 +217,11 @@ def test_mv_item_to_item_success( mock_confirm.return_value.ask.return_value = True # Execute command - target_path = cli_path_join(ws2.full_path, notebook.name) - cli_executor.exec_command(f"mv {notebook.full_path} {target_path} --force") + target_path = cli_path_join(ws2.full_path, item.name) + cli_executor.exec_command(f"mv {item.full_path} {target_path} --force") # Clean up - update the full path of the moved items so the factory can clean them up - notebook.full_path = cli_path_join(ws2.full_path, notebook.name) + item.full_path = cli_path_join(ws2.full_path, item.name) # Assert mock_print_done.assert_called() @@ -223,17 +230,22 @@ def test_mv_item_to_item_success( mock_questionary_print.reset_mock() ls(ws1.full_path) assert all( - notebook.display_name not in call.args[0] + item.display_name not in call.args[0] for call in mock_questionary_print.mock_calls ) mock_questionary_print.reset_mock() ls(ws2.full_path) assert any( - notebook.display_name in call.args[0] + item.display_name in call.args[0] for call in mock_questionary_print.mock_calls ) + @pytest.mark.parametrize("unsupported_item_type", [ + ItemType.EVENTHOUSE, + ItemType.KQL_DATABASE, + ItemType.EVENTSTREAM, + ]) def test_mv_item_to_item_unsupported_failure( self, workspace_factory, @@ -243,13 +255,12 @@ def test_mv_item_to_item_unsupported_failure( mock_fab_ui_print_error, cli_executor: CLIExecutor, mock_print_warning, + unsupported_item_type, ): # Setup ws1 = workspace_factory() ws2 = workspace_factory() - eventhouse = item_factory(ItemType.EVENTHOUSE, ws1.full_path) - kql_db = item_factory(ItemType.KQL_DATABASE, ws1.full_path) - eventstream = item_factory(ItemType.EVENTSTREAM, ws1.full_path) + item = item_factory(unsupported_item_type, ws1.full_path) # Reset mock mock_print_done.reset_mock() @@ -260,29 +271,8 @@ def test_mv_item_to_item_unsupported_failure( mock_confirm.return_value.ask.return_value = True # Execute command - # EventHouse - target_path = cli_path_join(ws2.full_path, eventhouse.name) - cli_executor.exec_command( - f"mv {eventhouse.full_path} {target_path} --force" - ) - - assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) - - mock_fab_ui_print_error.reset_mock() - - # KqlDB - target_path = cli_path_join(ws2.full_path, kql_db.name) - cli_executor.exec_command(f"mv {kql_db.full_path} {target_path} --force") - - assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) - - mock_fab_ui_print_error.reset_mock() - - # EventStream - target_path = cli_path_join(ws2.full_path, eventstream.name) - cli_executor.exec_command( - f"mv {eventstream.full_path} {target_path} --force" - ) + target_path = cli_path_join(ws2.full_path, item.name) + cli_executor.exec_command(f"mv {item.full_path} {target_path} --force") assert_fabric_cli_error(constant.ERROR_UNSUPPORTED_COMMAND) @@ -499,20 +489,35 @@ def test_mv_workspace_to_item_type_mismatch_failure( # Assert assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) + @pytest.mark.parametrize("source_type,target_type", [ + (ItemType.NOTEBOOK, ItemType.DATA_PIPELINE), + (ItemType.REPORT, ItemType.LAKEHOUSE), + (ItemType.SEMANTIC_MODEL, ItemType.WAREHOUSE) + ]) def test_mv_item_to_item_type_mismatch_failure( - self, item_factory, cli_executor: CLIExecutor, assert_fabric_cli_error + self, + item_factory, + cli_executor: CLIExecutor, + assert_fabric_cli_error, + source_type, + target_type, ): # Setup - notebook = item_factory(ItemType.NOTEBOOK) - data_pipeline = item_factory(ItemType.DATA_PIPELINE) + source_item = item_factory(source_type) + target_item = item_factory(target_type) cli_executor.exec_command( - f"mv {data_pipeline.full_path} {notebook.full_path} --force" + f"mv {source_item.full_path} {target_item.full_path} --force" ) # Assert assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, + ]) def test_mv_item_within_workspace_rename_success( self, workspace_factory, @@ -520,11 +525,12 @@ def test_mv_item_within_workspace_rename_success( mock_print_done, mock_questionary_print, cli_executor: CLIExecutor, + item_type, ): # Setup ws1 = workspace_factory() # Create item in ws1 - notebook = item_factory(ItemType.NOTEBOOK, ws1.full_path) + item = item_factory(item_type, ws1.full_path) # Reset mock mock_print_done.reset_mock() @@ -533,14 +539,14 @@ def test_mv_item_within_workspace_rename_success( with patch("questionary.confirm") as mock_confirm: mock_confirm.return_value.ask.return_value = True - renamed_notebook_name = f"{notebook.display_name} Renamed.Notebook" + renamed_item_name = f"{item.display_name} Renamed.{item_type}" # Execute command - target_path = cli_path_join(ws1.full_path, renamed_notebook_name) - cli_executor.exec_command(f"mv {notebook.full_path} {target_path} --force") + target_path = cli_path_join(ws1.full_path, renamed_item_name) + cli_executor.exec_command(f"mv {item.full_path} {target_path} --force") # Clean up - update the full path of the moved items so the factory can clean them up - notebook.full_path = target_path + item.full_path = target_path # Assert mock_print_done.assert_called() @@ -551,11 +557,11 @@ def test_mv_item_within_workspace_rename_success( mock_questionary_print.reset_mock() ls(ws1.full_path) assert all( - notebook.name not in call.args[0] + item.name not in call.args[0] for call in mock_questionary_print.mock_calls ) assert any( - renamed_notebook_name in call.args[0] + renamed_item_name in call.args[0] for call in mock_questionary_print.mock_calls ) diff --git a/tests/test_commands/test_rm.py b/tests/test_commands/test_rm.py index d68f82e7..8d4454e8 100644 --- a/tests/test_commands/test_rm.py +++ b/tests/test_commands/test_rm.py @@ -25,13 +25,17 @@ from tests.test_commands.data.static_test_data import StaticTestData from tests.test_commands.processors import generate_random_string from tests.test_commands.utils import cli_path_join +from tests.test_commands.conftest import basic_item_parametrize, custom_parametrize class TestRM: # region ITEM + + @custom_parametrize def test_rm_item_success( self, workspace, + item_type, cli_executor, mock_questionary_print, mock_print_warning, @@ -40,31 +44,33 @@ def test_rm_item_success( cassette_name, ): # Setup - notebook = set_entity_metadata( - vcr_instance, cassette_name, "Notebook", workspace.full_path + item = set_entity_metadata( + vcr_instance, cassette_name, item_type, workspace.full_path ) - mkdir(notebook.full_path) + mkdir(item.full_path) mock_print_done.reset_mock() # Execute command - cli_executor.exec_command(f"rm {notebook.full_path} --force") + cli_executor.exec_command(f"rm {item.full_path} --force") # Assert mock_print_warning.assert_called() mock_questionary_print.assert_called() mock_print_done.assert_called_once() _assert_strings_in_mock_calls( - [notebook.display_name], True, mock_questionary_print.mock_calls + [item.display_name], True, mock_questionary_print.mock_calls ) _assert_strings_in_mock_calls( - [notebook.display_name], True, mock_print_done.mock_calls + [item.display_name], True, mock_print_done.mock_calls ) - _assert_not_found(notebook.full_path) + _assert_not_found(item.full_path) + @custom_parametrize def test_rm_item_without_force_success( self, workspace, + item_type, cli_executor, mock_questionary_print, mock_print_done, @@ -72,10 +78,10 @@ def test_rm_item_without_force_success( cassette_name, ): # Setup - notebook = set_entity_metadata( - vcr_instance, cassette_name, "Notebook", workspace.full_path + item = set_entity_metadata( + vcr_instance, cassette_name, item_type, workspace.full_path ) - mkdir(notebook.full_path) + mkdir(item.full_path) # Reset mocks mock_print_done.reset_mock() mock_questionary_print.reset_mock() @@ -84,24 +90,35 @@ def test_rm_item_without_force_success( mock_confirm.return_value.ask.return_value = True # Execute command - cli_executor.exec_command(f"rm {notebook.full_path}") + cli_executor.exec_command(f"rm {item.full_path}") # Assert mock_confirm.assert_called_once() mock_questionary_print.assert_called_once() mock_print_done.assert_called_once() _assert_strings_in_mock_calls( - [notebook.display_name], True, mock_questionary_print.mock_calls + [item.display_name], True, mock_questionary_print.mock_calls ) _assert_strings_in_mock_calls( - [notebook.display_name], True, mock_print_done.mock_calls + [item.display_name], True, mock_print_done.mock_calls ) - _assert_not_found(notebook.full_path) + _assert_not_found(item.full_path) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, + ItemType.ENVIRONMENT, ItemType.EVENTHOUSE, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, + ItemType.LAKEHOUSE, ItemType.ML_EXPERIMENT, ItemType.ML_MODEL, + ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK, + ItemType.REFLEX, ItemType.SQL_DATABASE, ItemType.SEMANTIC_MODEL, + ItemType.SPARK_JOB_DEFINITION, ItemType.WAREHOUSE, ItemType.COPYJOB, + ItemType.GRAPHQLAPI, ItemType.DATAFLOW, +]) def test_rm_item_without_force_cancel_operation_success( self, workspace, + item_type, cli_executor, mock_questionary_print, mock_print_done, @@ -110,10 +127,10 @@ def test_rm_item_without_force_cancel_operation_success( cassette_name, ): # Setup - notebook = set_entity_metadata( - vcr_instance, cassette_name, "Notebook", workspace.full_path + item = set_entity_metadata( + vcr_instance, cassette_name, item_type, workspace.full_path ) - mkdir(notebook.full_path) + mkdir(item.full_path) # Reset mocks mock_print_done.reset_mock() mock_questionary_print.reset_mock() @@ -122,7 +139,7 @@ def test_rm_item_without_force_cancel_operation_success( mock_confirm.return_value.ask.return_value = False # Execute command - cli_executor.exec_command(f"rm {notebook.full_path}") + cli_executor.exec_command(f"rm {item.full_path}") # Assert mock_print_warning.assert_called_once() @@ -130,6 +147,35 @@ def test_rm_item_without_force_cancel_operation_success( mock_questionary_print.assert_not_called() mock_print_done.assert_not_called() + @pytest.mark.parametrize("unsupported_item_type", [ + ItemType.DASHBOARD, + ItemType.DATAMART, + ItemType.MIRRORED_WAREHOUSE, + ItemType.PAGINATED_REPORT, + ItemType.SQL_ENDPOINT, + ]) + def test_rm_unsupported_item_failure( + self, + unsupported_item_type, + workspace_factory, + cli_executor, + assert_fabric_cli_error, + vcr_instance, + cassette_name, + ): + workspace = workspace_factory() + + # Create unsupported item metadata + item_display_name = generate_random_string(vcr_instance, cassette_name) + item_name = f"{item_display_name}.{unsupported_item_type}" + item_full_path = cli_path_join(workspace.full_path, item_name) + + # Execute command + cli_executor.exec_command(f"rm {item_full_path} --force") + + # Assert + assert_fabric_cli_error(constant.ERROR_NOT_FOUND) + # endregion # region WORKSPACE diff --git a/tests/test_commands/test_set.py b/tests/test_commands/test_set.py index a55e8c61..a174918a 100644 --- a/tests/test_commands/test_set.py +++ b/tests/test_commands/test_set.py @@ -20,6 +20,7 @@ VirtualWorkspaceType, ) from fabric_cli.core.hiearchy.fab_onelake_element import OneLakeItem +from tests.test_commands.conftest import basic_item_parametrize from tests.test_commands.data.models import EntityMetadata from tests.test_commands.processors import generate_random_string from tests.test_commands.utils import cli_path_join @@ -27,6 +28,55 @@ class TestSET: # region Item + @pytest.mark.parametrize("entity_type,factory_method,entity_setup,should_cache", [ + ("item", "item_factory", ItemType.LAKEHOUSE, False), + ("workspace", "workspace_factory", None, False), + ("sparkpool", "virtual_item_factory", VirtualItemContainerType.SPARK_POOL, False), + ("domain", "virtual_workspace_item_factory", VirtualWorkspaceType.DOMAIN, False), + ]) + def test_set_entity_invalid_query_failure( + self, + entity_type, + factory_method, + entity_setup, + should_cache, + item_factory, + workspace_factory, + virtual_item_factory, + virtual_workspace_item_factory, + cli_executor, + assert_fabric_cli_error, + mock_questionary_print, + mock_print_done, + upsert_item_to_cache, + setup_config_values_for_capacity, + ): + # Setup based on entity type + if entity_type == "item": + entity = item_factory(entity_setup) + elif entity_type == "workspace": + entity = workspace_factory() + elif entity_type == "sparkpool": + entity = virtual_item_factory(entity_setup) + elif entity_type == "domain": + entity = virtual_workspace_item_factory(entity_setup) + + # Reset mocks + mock_questionary_print.reset_mock() + mock_print_done.reset_mock() + if should_cache: + upsert_item_to_cache.reset_mock() + + # Execute command + cli_executor.exec_command( + f"set {entity.full_path} --query non_existent_query --input new_value --force" + ) + + # Assert + assert_fabric_cli_error(constant.ERROR_INVALID_QUERY) + if should_cache: + upsert_item_to_cache.assert_not_called() + def test_set_item_invalid_query_failure( self, item_factory, @@ -84,6 +134,40 @@ def test_set_item_metadata_success( should_upsert_to_cache, ) + @pytest.mark.parametrize("item_type", [ + ItemType.DATA_PIPELINE, ItemType.ENVIRONMENT, ItemType.EVENTSTREAM, + ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET, ItemType.ML_EXPERIMENT, + ItemType.NOTEBOOK, ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION, + ]) + @pytest.mark.parametrize("metadata_to_set", ["description", "displayName"]) + def test_set_item_metadata_for_all_types_success( + self, + item_factory, + cli_executor, + mock_questionary_print, + mock_print_done, + upsert_item_to_cache, + metadata_to_set, + item_type, + vcr_instance, + cassette_name, + ): + # Setup + item = item_factory(item_type) + should_upsert_to_cache = metadata_to_set == "displayName" + + self._test_set_metadata_success( + item, + mock_questionary_print, + mock_print_done, + upsert_item_to_cache, + metadata_to_set, + cli_executor, + vcr_instance, + cassette_name, + should_upsert_to_cache, + ) + def test_set_item_report_definition_semantic_model_id_success( self, item_factory, @@ -156,6 +240,37 @@ def test_set_item_variable_library_properties_success( # endregion + def test_set_domain_contributors_scope_success( + self, + virtual_workspace_item_factory, + cli_executor, + mock_questionary_print, + mock_print_done, + setup_config_values_for_capacity, + upsert_domain_to_cache, + ): + # Setup + domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) + + # Reset mocks + mock_questionary_print.reset_mock() + mock_print_done.reset_mock() + if upsert_domain_to_cache: + upsert_domain_to_cache.reset_mock() + + # Execute command + cli_executor.exec_command( + f"set {domain.full_path} --query contributorsScope --input AdminsOnly --force" + ) + + # Assert + mock_print_done.assert_called_once() + if upsert_domain_to_cache: + upsert_domain_to_cache.assert_not_called() + + get(domain.full_path, query="contributorsScope") + assert mock_questionary_print.call_args[0][0].lower() == "adminsonly" + # region Workspace def test_set_workspace_invalid_query_failure( self, diff --git a/tests/test_commands/test_unassign.py b/tests/test_commands/test_unassign.py index 23deeafe..9a3f0940 100644 --- a/tests/test_commands/test_unassign.py +++ b/tests/test_commands/test_unassign.py @@ -4,6 +4,8 @@ import argparse from unittest.mock import patch +import pytest + import fabric_cli.commands.fs.fab_fs_assign as fab_assign import fabric_cli.commands.fs.fab_fs_unassign as fab_unassign from fabric_cli.commands.fs import fab_fs_get @@ -14,6 +16,123 @@ class TestUnassign: + # region Parametrized Tests + @pytest.mark.parametrize("entity_type,factory_key,path_template,assertion_key", [ + (VirtualWorkspaceType.CAPACITY, "test_data", "/.capacities/{}.Capacity", "id"), + (VirtualWorkspaceType.DOMAIN, "virtual_workspace_item_factory", "{}.full_path", "display_name"), + ]) + def test_unassign_entity_workspace_success( + self, + entity_type, + factory_key, + path_template, + assertion_key, + workspace_factory, + cli_executor, + mock_questionary_print, + test_data: StaticTestData, + virtual_workspace_item_factory, + ): + # Setup + workspace = workspace_factory() + mock_questionary_print.reset_mock() + + if factory_key == "test_data": + # Capacity scenario + entity_path = path_template.format(test_data.capacity.name) + assertion_value = getattr(test_data.capacity, assertion_key) + else: + # Domain scenario + domain = virtual_workspace_item_factory(entity_type) + assign(domain.full_path, workspace.full_path) + entity_path = domain.full_path + assertion_value = getattr(domain, assertion_key) + + # Execute command + cli_executor.exec_command( + f"unassign {entity_path} --workspace {workspace.full_path} --force" + ) + + # Assert + if entity_type == VirtualWorkspaceType.CAPACITY: + get(workspace.full_path, query=".") + else: + get(entity_path, query="domainWorkspaces") + + assert any( + str(assertion_value) not in str(call.args[0]) + for call in mock_questionary_print.mock_calls + ) + + @pytest.mark.parametrize("entity_type,factory_key,path_template", [ + (VirtualWorkspaceType.CAPACITY, "test_data", "/.capacities/{}.Capacity"), + (VirtualWorkspaceType.DOMAIN, "virtual_workspace_item_factory", "{}.full_path"), + ]) + def test_unassign_entity_workspace_not_assigned_failure( + self, + entity_type, + factory_key, + path_template, + workspace_factory, + cli_executor, + assert_fabric_cli_error, + test_data: StaticTestData, + virtual_workspace_item_factory, + ): + # Setup + workspace = workspace_factory() + + if factory_key == "test_data": + # Capacity scenario - ensure it's unassigned first + entity_path = path_template.format(test_data.capacity.name) + unassign(entity_path, workspace.full_path) + else: + # Domain scenario - just create domain without assigning + domain = virtual_workspace_item_factory(entity_type) + entity_path = domain.full_path + + # Execute command + cli_executor.exec_command( + f"unassign {entity_path} --workspace {workspace.full_path} --force" + ) + + # Assert + assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) + + @pytest.mark.parametrize("entity_type,factory_key,path_template", [ + (VirtualWorkspaceType.CAPACITY, "test_data", "/.capacities/{}.Capacity"), + (VirtualWorkspaceType.DOMAIN, "virtual_workspace_item_factory", "{}.full_path"), + ]) + def test_unassign_entity_item_not_supported_failure( + self, + entity_type, + factory_key, + path_template, + item_factory, + cli_executor, + assert_fabric_cli_error, + test_data: StaticTestData, + virtual_workspace_item_factory, + ): + # Setup + lakehouse = item_factory(ItemType.LAKEHOUSE) + + if factory_key == "test_data": + entity_path = path_template.format(test_data.capacity.name) + else: + domain = virtual_workspace_item_factory(entity_type) + entity_path = domain.full_path + + # Execute command + cli_executor.exec_command( + f"unassign {entity_path} --workspace {lakehouse.full_path} --force" + ) + + # Assert + assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) + + # endregion + # region CAPACITY TESTS def test_unassign_capacity_workspace_success( self, @@ -107,113 +226,6 @@ def test_unassign_capacity_workspace_without_force_cancel_operation_success( for call in mock_questionary_print.mock_calls ) - def test_unassign_capacity_workspace_not_assigned_failure( - self, - workspace_factory, - cli_executor, - assert_fabric_cli_error, - test_data: StaticTestData, - ): - # Setup - workspace = workspace_factory() - capacity_full_path = f"/.capacities/{test_data.capacity.name}.Capacity" - unassign(capacity_full_path, workspace.full_path) - - # Execute command - cli_executor.exec_command( - f"unassign {capacity_full_path} --workspace {workspace.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) - - def test_unassign_capacity_item_not_supported_failure( - self, - item_factory, - cli_executor, - assert_fabric_cli_error, - test_data: StaticTestData, - ): - # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) - capacity_full_path = f"/.capacities/{test_data.capacity.name}.Capacity" - - # Execute command - cli_executor.exec_command( - f"unassign {capacity_full_path} --workspace {lakehouse.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) - - # endregion - - # region DOMAIN TESTS - def test_unassign_domain_workspace_success( - self, - workspace_factory, - cli_executor, - virtual_workspace_item_factory, - mock_questionary_print, - ): - # Setup - workspace = workspace_factory() - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) - assign(domain.full_path, workspace.full_path) - mock_questionary_print.reset_mock() - - # Execute command - cli_executor.exec_command( - f"unassign {domain.full_path} --workspace {workspace.full_path} --force" - ) - - # Assert - get(domain.full_path, query="domainWorkspaces") - assert any( - workspace.display_name not in call.args[0] - for call in mock_questionary_print.mock_calls - ) - - def test_unassign_domain_workspace_not_assigned_failure( - self, - workspace_factory, - cli_executor, - virtual_workspace_item_factory, - mock_questionary_print, - assert_fabric_cli_error, - ): - # Setup - workspace = workspace_factory() - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) - mock_questionary_print.reset_mock() - - # Execute command - cli_executor.exec_command( - f"unassign {domain.full_path} --workspace {workspace.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_INVALID_INPUT) - - def test_unassign_domain_item_not_supported_failure( - self, - item_factory, - cli_executor, - virtual_workspace_item_factory, - assert_fabric_cli_error, - ): - # Setup - lakehouse = item_factory(ItemType.LAKEHOUSE) - domain = virtual_workspace_item_factory(VirtualWorkspaceType.DOMAIN) - - # Execute command - cli_executor.exec_command( - f"unassign {domain.full_path} --workspace {lakehouse.full_path} --force" - ) - - # Assert - assert_fabric_cli_error(constant.ERROR_NOT_SUPPORTED) - # endregion