File: disable_test_cli_mgmt_powerbidedicated.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (116 lines) | stat: -rw-r--r-- 4,492 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# coding: utf-8

#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------


# TEST SCENARIO COVERAGE
# ----------------------
# Methods Total   : 12
# Methods Covered : 11
# Examples Total  : 11
# Examples Tested : 11
# Coverage %      : 92
# ----------------------

import unittest

import azure.mgmt.powerbidedicated
from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer

AZURE_LOCATION = 'eastus'

class MgmtPowerBIDedicatedTest(AzureMgmtTestCase):

    def setUp(self):
        super(MgmtPowerBIDedicatedTest, self).setUp()
        self.mgmt_client = self.create_mgmt_client(
            azure.mgmt.powerbidedicated.PowerBIDedicatedManagementClient
        )
    
    @unittest.skip("skip test")
    @ResourceGroupPreparer(location=AZURE_LOCATION)
    def test_powerbidedicated(self, resource_group):

        SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID
        TENANT_ID = self.settings.TENANT_ID
        RESOURCE_GROUP = resource_group.name
        DEDICATED_CAPACITY_NAME = "mydedicatedcapacity"
        LOCATION = "myLocation"

        # /Capacities/put/Create capacity[put]i
        BODY = {
          "sku": {
            "name": "A1",
            "tier": "PBIE_Azure"
          },
          "tags": {
            "test_key": "testValue"
          },
          "administration": {
           "members": [
             "user1@microsoft.com",
             "user2@microsoft.com"
           ]
          },
          "location": "eastus"
        }
        result = self.mgmt_client.capacities.create(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME, capacity_parameters=BODY)
        result = result.result()

        # /Capacities/get/List eligible SKUs for an existing capacity[get]
        result = self.mgmt_client.capacities.list_skus_for_capacity(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)

        # /Capacities/get/Get details of a capacity[get]
        result = self.mgmt_client.capacities.get_details(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)

        # /Capacities/get/List capacities in resource group[get]
        result = self.mgmt_client.capacities.list_by_resource_group(resource_group_name=RESOURCE_GROUP)

        # /Capacities/get/Get details of a capacity[get]
        result = self.mgmt_client.capacities.get_details(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)

        # /Capacities/get/List eligible SKUs for a new capacity[get]
        result = self.mgmt_client.capacities.list_skus()

        # /Capacities/post/Suspend capacity[post]
        result = self.mgmt_client.capacities.suspend(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)
        result = result.result()

        # /Capacities/post/Get details of a capacity[post]
        result = self.mgmt_client.capacities.resume(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)
        result = result.result()

        # /Capacities/patch/Update capacity parameters[patch]
        BODY = {
          "sku": {
            "name": "A1",
            "tier": "PBIE_Azure"
          },
          "tags": {
            "test_key": "testValue"
          },
          "administration": {
            "members": [
             "user1@microsoft.com",
             "user2@microsoft.com"
            ]
          }
        }
        result = self.mgmt_client.capacities.update(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME, capacity_update_parameters=BODY)
        result = result.result()

        # /Capacities/post/Check name availability of a capacity[post]
        result = self.mgmt_client.capacities.check_name_availability(location="eastus", name="azsdktest", type="Microsoft.PowerBIDedicated/capacities")

        # /Capacities/delete/Get details of a capacity[delete]
        result = self.mgmt_client.capacities.delete(resource_group_name=RESOURCE_GROUP, dedicated_capacity_name=DEDICATED_CAPACITY_NAME)
        result = result.result()


#------------------------------------------------------------------------------
if __name__ == '__main__':
    unittest.main()