Skip to content

Commit cde8838

Browse files
test: add recordings for new cp tests (#153)
Co-authored-by: Alon Yeshurun <98805507+ayeshurun@users.noreply.github.com>
1 parent 993dd53 commit cde8838

File tree

46 files changed

+63907
-11010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+63907
-11010
lines changed

tests/test_commands/conftest.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,20 @@
296296
(ItemType.GRAPH_QUERY_SET, ".txt")
297297
])
298298

299+
# TODO: Fix capacity teardown issue CannotOverwriteExistingCassetteException & uncomment the item parameter
300+
cp_virtual_workspace_item_failure_params = pytest.mark.parametrize("virtual_workspace_type", [
301+
VirtualWorkspaceType.DOMAIN,
302+
# VirtualWorkspaceType.CAPACITY,
303+
VirtualWorkspaceType.GATEWAY,
304+
])
305+
306+
cp_item_types_success_params = pytest.mark.parametrize("item_type", [
307+
ItemType.DATA_PIPELINE, ItemType.KQL_DASHBOARD, ItemType.KQL_QUERYSET,
308+
ItemType.MIRRORED_DATABASE, ItemType.NOTEBOOK,
309+
ItemType.REFLEX, ItemType.SPARK_JOB_DEFINITION,
310+
ItemType.COSMOS_DB_DATABASE, ItemType.USER_DATA_FUNCTION,
311+
])
312+
299313
assign_entity_item_not_supported_failure_parameters = pytest.mark.parametrize("entity_type,factory_key,path_template", [
300314
(VirtualWorkspaceType.CAPACITY, "test_data", "/.capacities/{}.Capacity"),
301315
(VirtualWorkspaceType.DOMAIN, "virtual_workspace_item_factory", "{}.full_path"),
@@ -783,7 +797,9 @@ def _create_workspace(special_character=None):
783797

784798
@pytest.fixture
785799
def virtual_workspace_item_factory(
786-
vcr_instance, cassette_name, test_data: StaticTestData
800+
vcr_instance,
801+
cassette_name,
802+
test_data: StaticTestData,
787803
):
788804
# Keep track of all workspaces created during this test
789805
created_virtual_workspace_items = []
@@ -814,8 +830,7 @@ def _create_virtual_workspace_item(type: VirtualWorkspaceType):
814830

815831
# Build the metadata for the created resource
816832
metadata = EntityMetadata(
817-
generated_name, virtual_workspace_name, virtual_workspace_item_path
818-
)
833+
generated_name, virtual_workspace_name, virtual_workspace_item_path)
819834
created_virtual_workspace_items.append(metadata)
820835
return metadata
821836

tests/test_commands/data/models.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4+
from typing import Any
5+
6+
47
class User:
58
def __init__(self, user_data: dict[str, str]):
69
# Expecting keys: "id", "upn"
@@ -56,10 +59,13 @@ def name(self) -> str:
5659

5760

5861
class EntityMetadata:
59-
def __init__(self, display_name: str, name: str, full_path: str):
62+
def __init__(
63+
self, display_name: str, name: str, full_path: str, type: Any = None
64+
):
6065
self._display_name = display_name
6166
self._name = name
6267
self._full_path = full_path
68+
self._type = type
6369

6470
@property
6571
def display_name(self) -> str:
@@ -75,7 +81,7 @@ def full_path(self) -> str:
7581

7682
# This setter is required for the mv command
7783
@full_path.setter
78-
def full_path(self, new_path):
84+
def full_path(self, new_path: str) -> None:
7985
self._full_path = new_path
8086

8187

@@ -123,16 +129,18 @@ def username(self) -> str:
123129
def password(self) -> str:
124130
return self._password
125131

132+
126133
class OnPremisesGatewayDetails:
127134
def __init__(self, gateway_data: dict[str, str]):
128135
# Expecting keys: "id", "encrypted_credentials"
129136
self._id = gateway_data.get("id") or ""
130-
self._encrypted_credentials = gateway_data.get("encrypted_credentials") or ""
137+
self._encrypted_credentials = gateway_data.get(
138+
"encrypted_credentials") or ""
131139

132140
@property
133141
def id(self) -> str:
134142
return self._id
135143

136144
@property
137145
def encrypted_credentials(self) -> str:
138-
return self._encrypted_credentials
146+
return self._encrypted_credentials

tests/test_commands/recordings/test_commands/test_cp/class_setup.yaml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interactions:
1111
Content-Type:
1212
- application/json
1313
User-Agent:
14-
- ms-fabric-cli/1.1.0 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
14+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
1515
method: GET
1616
uri: https://api.fabric.microsoft.com/v1/workspaces
1717
response:
@@ -26,15 +26,15 @@ interactions:
2626
Content-Encoding:
2727
- gzip
2828
Content-Length:
29-
- '818'
29+
- '2771'
3030
Content-Type:
3131
- application/json; charset=utf-8
3232
Date:
33-
- Mon, 29 Sep 2025 17:13:58 GMT
33+
- Fri, 06 Feb 2026 07:06:19 GMT
3434
Pragma:
3535
- no-cache
3636
RequestId:
37-
- 2102248d-7c3d-48dc-b9d0-6c9a88056ae0
37+
- 3aab06b8-f3d5-4db2-a228-3f01423767b3
3838
Strict-Transport-Security:
3939
- max-age=31536000; includeSubDomains
4040
X-Content-Type-Options:
@@ -60,7 +60,7 @@ interactions:
6060
Content-Type:
6161
- application/json
6262
User-Agent:
63-
- ms-fabric-cli/1.1.0 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
63+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
6464
method: GET
6565
uri: https://api.fabric.microsoft.com/v1/workspaces
6666
response:
@@ -75,15 +75,15 @@ interactions:
7575
Content-Encoding:
7676
- gzip
7777
Content-Length:
78-
- '818'
78+
- '2771'
7979
Content-Type:
8080
- application/json; charset=utf-8
8181
Date:
82-
- Mon, 29 Sep 2025 17:14:00 GMT
82+
- Fri, 06 Feb 2026 07:06:20 GMT
8383
Pragma:
8484
- no-cache
8585
RequestId:
86-
- 9b6586f5-b38c-4aa4-a620-eeb9e6b804a0
86+
- 3285752a-c344-4be1-b840-f41c57a840e3
8787
Strict-Transport-Security:
8888
- max-age=31536000; includeSubDomains
8989
X-Content-Type-Options:
@@ -109,13 +109,13 @@ interactions:
109109
Content-Type:
110110
- application/json
111111
User-Agent:
112-
- ms-fabric-cli/1.1.0 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
112+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
113113
method: GET
114114
uri: https://api.fabric.microsoft.com/v1/capacities
115115
response:
116116
body:
117117
string: '{"value": [{"id": "00000000-0000-0000-0000-000000000004", "displayName":
118-
"mocked_fabriccli_capacity_name", "sku": "F2", "region": "Central US", "state":
118+
"mocked_fabriccli_capacity_name", "sku": "F16", "region": "Central US", "state":
119119
"Active"}]}'
120120
headers:
121121
Access-Control-Expose-Headers:
@@ -125,15 +125,15 @@ interactions:
125125
Content-Encoding:
126126
- gzip
127127
Content-Length:
128-
- '271'
128+
- '424'
129129
Content-Type:
130130
- application/json; charset=utf-8
131131
Date:
132-
- Mon, 29 Sep 2025 17:14:05 GMT
132+
- Fri, 06 Feb 2026 07:06:26 GMT
133133
Pragma:
134134
- no-cache
135135
RequestId:
136-
- a7eb91ea-ff9c-4274-94ad-7ba1fb12d12c
136+
- fc025862-a234-452f-b8d0-8bda23984394
137137
Strict-Transport-Security:
138138
- max-age=31536000; includeSubDomains
139139
X-Content-Type-Options:
@@ -162,12 +162,12 @@ interactions:
162162
Content-Type:
163163
- application/json
164164
User-Agent:
165-
- ms-fabric-cli/1.1.0 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
165+
- ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
166166
method: POST
167167
uri: https://api.fabric.microsoft.com/v1/workspaces
168168
response:
169169
body:
170-
string: '{"id": "08bfc868-2a78-49cd-a320-0ae9101a5ab1", "displayName": "fabriccli_WorkspacePerTestclass_000001",
170+
string: '{"id": "e0c56f4e-e523-4a5a-84b3-0cc7285a0897", "displayName": "fabriccli_WorkspacePerTestclass_000001",
171171
"description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}'
172172
headers:
173173
Access-Control-Expose-Headers:
@@ -177,17 +177,17 @@ interactions:
177177
Content-Encoding:
178178
- gzip
179179
Content-Length:
180-
- '188'
180+
- '186'
181181
Content-Type:
182182
- application/json; charset=utf-8
183183
Date:
184-
- Mon, 29 Sep 2025 17:14:12 GMT
184+
- Fri, 06 Feb 2026 07:06:33 GMT
185185
Location:
186-
- https://api.fabric.microsoft.com/v1/workspaces/08bfc868-2a78-49cd-a320-0ae9101a5ab1
186+
- https://api.fabric.microsoft.com/v1/workspaces/e0c56f4e-e523-4a5a-84b3-0cc7285a0897
187187
Pragma:
188188
- no-cache
189189
RequestId:
190-
- aca72272-d3d6-4707-9a11-eefc668666c6
190+
- 7a758e47-2adf-48da-aebf-0043feb0485d
191191
Strict-Transport-Security:
192192
- max-age=31536000; includeSubDomains
193193
X-Content-Type-Options:
@@ -213,13 +213,13 @@ interactions:
213213
Content-Type:
214214
- application/json
215215
User-Agent:
216-
- ms-fabric-cli/1.1.0 (cp; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
216+
- ms-fabric-cli/1.3.1 (cp; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
217217
method: GET
218218
uri: https://api.fabric.microsoft.com/v1/workspaces
219219
response:
220220
body:
221221
string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName":
222-
"My workspace", "description": "", "type": "Personal"}, {"id": "08bfc868-2a78-49cd-a320-0ae9101a5ab1",
222+
"My workspace", "description": "", "type": "Personal"}, {"id": "e0c56f4e-e523-4a5a-84b3-0cc7285a0897",
223223
"displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created
224224
by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}'
225225
headers:
@@ -230,15 +230,15 @@ interactions:
230230
Content-Encoding:
231231
- gzip
232232
Content-Length:
233-
- '853'
233+
- '2805'
234234
Content-Type:
235235
- application/json; charset=utf-8
236236
Date:
237-
- Mon, 29 Sep 2025 17:15:53 GMT
237+
- Fri, 06 Feb 2026 08:40:01 GMT
238238
Pragma:
239239
- no-cache
240240
RequestId:
241-
- 4bbc73b7-edb2-4065-aa56-3e41f4fd802e
241+
- d99b7bb5-50ec-42bc-bef9-0a1ed567c414
242242
Strict-Transport-Security:
243243
- max-age=31536000; includeSubDomains
244244
X-Content-Type-Options:
@@ -264,9 +264,9 @@ interactions:
264264
Content-Type:
265265
- application/json
266266
User-Agent:
267-
- ms-fabric-cli/1.1.0 (cp; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
267+
- ms-fabric-cli/1.3.1 (cp; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
268268
method: GET
269-
uri: https://api.fabric.microsoft.com/v1/workspaces/08bfc868-2a78-49cd-a320-0ae9101a5ab1/items
269+
uri: https://api.fabric.microsoft.com/v1/workspaces/e0c56f4e-e523-4a5a-84b3-0cc7285a0897/items
270270
response:
271271
body:
272272
string: '{"value": []}'
@@ -282,11 +282,11 @@ interactions:
282282
Content-Type:
283283
- application/json; charset=utf-8
284284
Date:
285-
- Mon, 29 Sep 2025 17:15:53 GMT
285+
- Fri, 06 Feb 2026 08:40:01 GMT
286286
Pragma:
287287
- no-cache
288288
RequestId:
289-
- d6ce2c38-affb-42c8-8a00-806f57ecd641
289+
- a09eadfa-11df-42d9-9aec-7e811e8c6a23
290290
Strict-Transport-Security:
291291
- max-age=31536000; includeSubDomains
292292
X-Content-Type-Options:
@@ -314,9 +314,9 @@ interactions:
314314
Content-Type:
315315
- application/json
316316
User-Agent:
317-
- ms-fabric-cli/1.1.0 (cp; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2)
317+
- ms-fabric-cli/1.3.1 (cp; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2)
318318
method: DELETE
319-
uri: https://api.fabric.microsoft.com/v1/workspaces/08bfc868-2a78-49cd-a320-0ae9101a5ab1
319+
uri: https://api.fabric.microsoft.com/v1/workspaces/e0c56f4e-e523-4a5a-84b3-0cc7285a0897
320320
response:
321321
body:
322322
string: ''
@@ -332,11 +332,11 @@ interactions:
332332
Content-Type:
333333
- application/octet-stream
334334
Date:
335-
- Mon, 29 Sep 2025 17:15:53 GMT
335+
- Fri, 06 Feb 2026 08:40:02 GMT
336336
Pragma:
337337
- no-cache
338338
RequestId:
339-
- 99b1c9e4-0b03-4f94-881b-4f01dca557fd
339+
- 3f0b7838-1987-449f-92f8-3bdab6296f6c
340340
Strict-Transport-Security:
341341
- max-age=31536000; includeSubDomains
342342
X-Content-Type-Options:

0 commit comments

Comments
 (0)