|
15 | 15 | _parse_cost_control_id, |
16 | 16 | ) |
17 | 17 | from azext_foundry_cost_control.custom import ( |
| 18 | + account_show, |
18 | 19 | account_update, |
19 | 20 | deployment_create, |
20 | 21 | deployment_update, |
@@ -53,6 +54,34 @@ def test_parse_cost_control_id_rejects_other_resource_type(self): |
53 | 54 | with self.assertRaises(InvalidArgumentValueError): |
54 | 55 | _parse_cost_control_id(ACCOUNT_ID) |
55 | 56 |
|
| 57 | + @mock.patch("azext_foundry_cost_control.custom.show_resource") |
| 58 | + @mock.patch("azext_foundry_cost_control.custom.resource_id", return_value=ACCOUNT_ID) |
| 59 | + @mock.patch("azext_foundry_cost_control.custom.get_subscription_id", return_value="subscription-id") |
| 60 | + def test_account_show_uses_preview_api( |
| 61 | + self, get_subscription_id_mock, resource_id_mock, show_resource_mock): |
| 62 | + cmd = mock.Mock() |
| 63 | + |
| 64 | + result = account_show( |
| 65 | + cmd=cmd, |
| 66 | + resource_group_name="test-rg", |
| 67 | + account_name="test-account", |
| 68 | + ) |
| 69 | + |
| 70 | + self.assertIs(result, show_resource_mock.return_value) |
| 71 | + get_subscription_id_mock.assert_called_once_with(cmd.cli_ctx) |
| 72 | + resource_id_mock.assert_called_once_with( |
| 73 | + subscription="subscription-id", |
| 74 | + resource_group="test-rg", |
| 75 | + namespace="Microsoft.CognitiveServices", |
| 76 | + type="accounts", |
| 77 | + name="test-account", |
| 78 | + ) |
| 79 | + show_resource_mock.assert_called_once_with( |
| 80 | + cmd, |
| 81 | + resource_ids=[ACCOUNT_ID], |
| 82 | + api_version="2026-09-15-preview", |
| 83 | + ) |
| 84 | + |
56 | 85 | @mock.patch("azext_foundry_cost_control.custom.patch_resource") |
57 | 86 | @mock.patch("azext_foundry_cost_control.custom.resource_id", return_value=ACCOUNT_ID) |
58 | 87 | @mock.patch("azext_foundry_cost_control.custom.get_subscription_id", return_value="subscription-id") |
|
0 commit comments