Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions tests/test_commands/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
ItemType.REFLEX, ItemType.REPORT,
ItemType.SQL_DATABASE, ItemType.SEMANTIC_MODEL,
ItemType.SPARK_JOB_DEFINITION, ItemType.WAREHOUSE, ItemType.COPYJOB,
ItemType.GRAPHQLAPI, ItemType.DATAFLOW,
ItemType.GRAPHQLAPI, ItemType.DATAFLOW, ItemType.COSMOS_DB_DATABASE,
ItemType.USER_DATA_FUNCTION, ItemType.GRAPH_QUERY_SET, ItemType.DIGITAL_TWIN_BUILDER
])

basic_item_parametrize = pytest.mark.parametrize("item_type", [
Expand Down Expand Up @@ -267,7 +268,8 @@ def workspace(vcr_instance, test_data):
workspace_name = f"{display_name}.Workspace"
workspace_path = f"/{workspace_name}"

mkdir(workspace_path, params=[f"capacityName={test_data.capacity.name}"])
mkdir(workspace_path, params=[
f"capacityName={test_data.capacity.name}"])
yield EntityMetadata(display_name, workspace_name, workspace_path)
rm(workspace_path)

Expand All @@ -292,7 +294,8 @@ def _create_item(
generated_name = custom_name
else:
# Use the test's specific recording file
generated_name = generate_random_string(vcr_instance, cassette_name)
generated_name = generate_random_string(
vcr_instance, cassette_name)

item_name = f"{generated_name}.{type}"
item_path = cli_path_join(path, item_name)
Expand All @@ -318,7 +321,8 @@ def _create_item(
@pytest.fixture
def folder_factory(vcr_instance, cassette_name, workspace):
# Keep track of all folders created during this test
current_config = state_config.get_config(fab_constant.FAB_FOLDER_LISTING_ENABLED)
current_config = state_config.get_config(
fab_constant.FAB_FOLDER_LISTING_ENABLED)
state_config.set_config(fab_constant.FAB_FOLDER_LISTING_ENABLED, "true")
created_folders = []

Expand Down Expand Up @@ -348,7 +352,8 @@ def _create_folder(
for metadata in reversed(created_folders):
rm(metadata.full_path)

state_config.set_config(fab_constant.FAB_FOLDER_LISTING_ENABLED, current_config)
state_config.set_config(
fab_constant.FAB_FOLDER_LISTING_ENABLED, current_config)


@pytest.fixture
Expand All @@ -374,7 +379,8 @@ def _create_virtual_item(
"""
generated_name = generate_random_string(vcr_instance, cassette_name)
virtual_item_name = f"{generated_name}.{str(VICMap[type])}"
virtual_item_path = cli_path_join(workspace_path, str(type), virtual_item_name)
virtual_item_path = cli_path_join(
workspace_path, str(type), virtual_item_name)

match type:

Expand Down Expand Up @@ -427,7 +433,8 @@ def _create_virtual_item(
mkdir(virtual_item_path, params)

# Build the metadata for the created resource
metadata = EntityMetadata(generated_name, virtual_item_name, virtual_item_path)
metadata = EntityMetadata(
generated_name, virtual_item_name, virtual_item_path)
if should_clean:
created_virtual_items.append(metadata)
return metadata
Expand Down Expand Up @@ -457,10 +464,12 @@ def _create_workspace(special_character=None):
workspace_name = f"{generated_name}.Workspace"
workspace_path = f"/{workspace_name}"

mkdir(workspace_path, params=[f"capacityName={test_data.capacity.name}"])
mkdir(workspace_path, params=[
f"capacityName={test_data.capacity.name}"])

# Build the metadata for the created resource
metadata = EntityMetadata(generated_name, workspace_name, workspace_path)
metadata = EntityMetadata(
generated_name, workspace_name, workspace_path)
created_workspaces.append(metadata)
return metadata

Expand Down Expand Up @@ -565,7 +574,8 @@ def delete_cassette_if_record_mode_all(vcr_instance, cassette_name):
:param cassette_name: The name of the cassette file.
"""
if vcr_instance.record_mode == "all":
cassette_path = os.path.join(vcr_instance.cassette_library_dir, cassette_name)
cassette_path = os.path.join(
vcr_instance.cassette_library_dir, cassette_name)
if os.path.exists(cassette_path):
os.remove(cassette_path)

Expand Down Expand Up @@ -673,7 +683,8 @@ def setup_config_values_for_capacity(test_data: StaticTestData):
fab_default_az_location = state_config.get_config(
fab_constant.FAB_DEFAULT_AZ_LOCATION
)
fab_default_az_admin = state_config.get_config(fab_constant.FAB_DEFAULT_AZ_ADMIN)
fab_default_az_admin = state_config.get_config(
fab_constant.FAB_DEFAULT_AZ_ADMIN)

# Setup new values
state_config.set_config(
Expand All @@ -687,7 +698,8 @@ def setup_config_values_for_capacity(test_data: StaticTestData):
state_config.set_config(
fab_constant.FAB_DEFAULT_AZ_LOCATION, test_data.azure_location
)
state_config.set_config(fab_constant.FAB_DEFAULT_AZ_ADMIN, test_data.admin.upn)
state_config.set_config(
fab_constant.FAB_DEFAULT_AZ_ADMIN, test_data.admin.upn)

yield

Expand All @@ -701,7 +713,8 @@ def setup_config_values_for_capacity(test_data: StaticTestData):
state_config.set_config(
fab_constant.FAB_DEFAULT_AZ_LOCATION, fab_default_az_location
)
state_config.set_config(fab_constant.FAB_DEFAULT_AZ_ADMIN, fab_default_az_admin)
state_config.set_config(
fab_constant.FAB_DEFAULT_AZ_ADMIN, fab_default_az_admin)


# endregion
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '1662'
- '2425'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:16:19 GMT
- Tue, 03 Feb 2026 12:43:20 GMT
Pragma:
- no-cache
RequestId:
- e9e82624-60b4-40ae-8d9d-f0a28bd1b1b3
- ad0f88fc-e1a7-4fc3-a8ac-1f656a95cf20
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -75,15 +75,15 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '1662'
- '2425'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:16:20 GMT
- Tue, 03 Feb 2026 12:43:21 GMT
Pragma:
- no-cache
RequestId:
- 7d6ce758-a563-429c-9a19-79023b416099
- 71c0fe3d-27f8-4141-ba0e-0a1e9d27d230
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -115,7 +115,7 @@ interactions:
response:
body:
string: '{"value": [{"id": "00000000-0000-0000-0000-000000000004", "displayName":
"mocked_fabriccli_capacity_name", "sku": "F2", "region": "Central US", "state":
"mocked_fabriccli_capacity_name", "sku": "F16", "region": "Central US", "state":
"Active"}]}'
headers:
Access-Control-Expose-Headers:
Expand All @@ -125,15 +125,15 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '874'
- '425'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:16:23 GMT
- Tue, 03 Feb 2026 12:43:25 GMT
Pragma:
- no-cache
RequestId:
- 23ef28a2-85d7-45a7-a94a-0e19f62a4fde
- 6de2c085-409d-4bb0-9d9e-31d285255789
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -167,7 +167,7 @@ interactions:
uri: https://api.fabric.microsoft.com/v1/workspaces
response:
body:
string: '{"id": "030399b4-bbf7-4216-b61d-6698ae4292b6", "displayName": "fabriccli_WorkspacePerTestclass_000001",
string: '{"id": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6", "displayName": "fabriccli_WorkspacePerTestclass_000001",
"description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}'
headers:
Access-Control-Expose-Headers:
Expand All @@ -177,17 +177,17 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '188'
- '187'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:16:32 GMT
- Tue, 03 Feb 2026 12:43:33 GMT
Location:
- https://api.fabric.microsoft.com/v1/workspaces/030399b4-bbf7-4216-b61d-6698ae4292b6
- https://api.fabric.microsoft.com/v1/workspaces/fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6
Pragma:
- no-cache
RequestId:
- 5610440d-2709-49e0-add4-a27a5418d396
- dd5577c6-afa8-4bec-8f19-f1454c186c64
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -219,7 +219,7 @@ interactions:
response:
body:
string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName":
"My workspace", "description": "", "type": "Personal"}, {"id": "030399b4-bbf7-4216-b61d-6698ae4292b6",
"My workspace", "description": "", "type": "Personal"}, {"id": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6",
"displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created
by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}'
headers:
Expand All @@ -230,15 +230,15 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '1693'
- '2458'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:20:26 GMT
- Tue, 03 Feb 2026 12:47:30 GMT
Pragma:
- no-cache
RequestId:
- 8dc7f29e-0e56-4649-a292-e761d9e72634
- f45c7912-ea2b-4ab6-a24c-896cf01596b3
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -266,10 +266,17 @@ interactions:
User-Agent:
- ms-fabric-cli/1.3.1 (mkdir; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
method: GET
uri: https://api.fabric.microsoft.com/v1/workspaces/030399b4-bbf7-4216-b61d-6698ae4292b6/items
uri: https://api.fabric.microsoft.com/v1/workspaces/fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6/items
response:
body:
string: '{"value": []}'
string: '{"value": [{"id": "0dc4b3df-f86f-4b10-b667-d35cb521404d", "type": "SQLEndpoint",
"displayName": "fabcli000001dtdm", "description": "", "workspaceId": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6"},
{"id": "bd355473-8031-4dfd-b491-8b4db8f73416", "type": "SQLEndpoint", "displayName":
"fabcli000001dtdm", "description": "", "workspaceId": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6"},
{"id": "b73e7096-ca36-4a3c-9329-78910f950e61", "type": "Lakehouse", "displayName":
"fabcli000001dtdm", "description": "", "workspaceId": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6"},
{"id": "2d536924-c8ad-4ac3-9152-6ff82b940b49", "type": "Lakehouse", "displayName":
"fabcli000001dtdm", "description": "", "workspaceId": "fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6"}]}'
headers:
Access-Control-Expose-Headers:
- RequestId
Expand All @@ -278,15 +285,15 @@ interactions:
Content-Encoding:
- gzip
Content-Length:
- '32'
- '280'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 24 Dec 2025 11:20:31 GMT
- Tue, 03 Feb 2026 12:47:30 GMT
Pragma:
- no-cache
RequestId:
- cd256475-316e-4801-814c-e88852073bb3
- f4ce7c19-be5d-4b21-8340-653b27103805
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down Expand Up @@ -316,7 +323,7 @@ interactions:
User-Agent:
- ms-fabric-cli/1.3.1 (mkdir; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
method: DELETE
uri: https://api.fabric.microsoft.com/v1/workspaces/030399b4-bbf7-4216-b61d-6698ae4292b6
uri: https://api.fabric.microsoft.com/v1/workspaces/fcf5d32e-da97-4ce7-bd0b-bfbd2c9a7ba6
response:
body:
string: ''
Expand All @@ -332,11 +339,11 @@ interactions:
Content-Type:
- application/octet-stream
Date:
- Wed, 24 Dec 2025 11:20:36 GMT
- Tue, 03 Feb 2026 12:47:32 GMT
Pragma:
- no-cache
RequestId:
- b97b5b4b-c4a7-43c8-a192-fece84c53bac
- ed921d57-765c-468e-9929-ebabe4f41ce2
Strict-Transport-Security:
- max-age=31536000; includeSubDomains
X-Content-Type-Options:
Expand Down
Loading
Loading