File: disable_test_cli_mgmt_healthcareapis.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 (127 lines) | stat: -rw-r--r-- 3,921 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
117
118
119
120
121
122
123
124
125
126
127
# 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   : 9
# Methods Covered : 9
# Examples Total  : 9
# Examples Tested : 9
# Coverage %      : 100
# ----------------------

import unittest

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

AZURE_LOCATION = 'eastus'

class MgmtHealthcareApisTest(AzureMgmtTestCase):

    def setUp(self):
        super(MgmtHealthcareApisTest, self).setUp()
        self.mgmt_client = self.create_mgmt_client(
            azure.mgmt.healthcareapis.HealthcareApisManagementClient
        )
    
    @unittest.skip("skip test")
    @ResourceGroupPreparer(location=AZURE_LOCATION)
    def test_healthcareapis(self, resource_group):

        SERVICE_NAME = "myapimrndxyzabc"
        OPERATIONRESULT_NAME = "read"
        LOCATION_NAME = AZURE_LOCATION

        # ServicePut[put]
        BODY = {
          "location": "eastus",
          "kind": "fhir",
          "properties": {
            "access_policies": [
              {
                "object_id": "c487e7d1-3210-41a3-8ccc-e9372b78da47"
              },
              {
                "object_id": "5b307da8-43d4-492b-8b66-b0294ade872f"
              }
            ],
            "cosmos_db_configuration": {
              "offer_throughput": "1000"
            },
            "authentication_configuration": {
              "authority": "https://login.microsoftonline.com/abfde7b2-df0f-47e6-aabf-2462b07508dc",
              "audience": "https://azurehealthcareapis.com",
              "smart_proxy_enabled": True
            },
            "cors_configuration": {
              "origins": [
                "*"
              ],
              "headers": [
                "*"
              ],
              "methods": [
                "DELETE",
                "GET",
                "OPTIONS",
                "PATCH",
                "POST",
                "PUT"
              ],
              "max_age": "1440",
              "allow_credentials": False
            }
          }
        }
        result = self.mgmt_client.services.create_or_update(resource_group.name, SERVICE_NAME, BODY)
        result = result.result()

        # OperationResultsGet[get]
        result = self.mgmt_client.operation_results.get(LOCATION_NAME, OPERATIONRESULT_NAME)

        # ServiceGet[get]
        result = self.mgmt_client.services.get(resource_group.name, SERVICE_NAME)

        # ServiceListByResourceGroup[get]
        result = self.mgmt_client.services.list_by_resource_group(resource_group.name)

        # ServiceList[get]
        result = self.mgmt_client.services.list()

        # OperationsList[get]
        result = self.mgmt_client.operations.list()

        # ServicePatch[patch]
        BODY = {
          "tags": {
            "tag1": "value1",
            "tag2": "value2"
          }
        }
        result = self.mgmt_client.services.update(resource_group.name, SERVICE_NAME, BODY)
        result = result.result()

        # CheckNameAvailabilityPost[post]
        BODY = {
          "type": "Microsoft.HealthcareApis/services",
          "name": "serviceName"
        }
        NAME = SERVICE_NAME + 'ABC'
        TYPE = "Microsoft.HealthcareApis/services"
        result = self.mgmt_client.services.check_name_availability(NAME, TYPE)

        # ServiceDelete[delete]
        result = self.mgmt_client.services.delete(resource_group.name, SERVICE_NAME)
        result = result.result()


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