Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update-testcase
  • Loading branch information
ChenxiJiang333 committed Oct 30, 2024
commit 9541e7ff36dfbdf52c379c725311996376b040a7
11 changes: 3 additions & 8 deletions sdk/digitaltwins/azure-mgmt-digitaltwins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Release History

## 6.5.0 (2024-10-30)
## 7.0.0 (2024-10-30)

### Features Added
### Breaking Changes

- Method `DigitalTwinsEndpointOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, resource_name: str, endpoint_name: str, endpoint_description: IO[bytes], content_type: str)`
- Method `DigitalTwinsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, resource_name: str, digital_twins_create: IO[bytes], content_type: str)`
- Method `DigitalTwinsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, resource_name: str, digital_twins_patch_description: IO[bytes], content_type: str)`
- Method `DigitalTwinsOperations.check_name_availability` has a new overload `def check_name_availability(self: None, location: str, digital_twins_instance_check_name: IO[bytes], content_type: str)`
- Method `PrivateEndpointConnectionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: IO[bytes], content_type: str)`
- Method `TimeSeriesDatabaseConnectionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, resource_name: str, time_series_database_connection_name: str, time_series_database_connection_description: IO[bytes], content_type: str)`
- This package now only targets the latest Api-Version available on Azure and removes APIs of other Api-Version. After this change, the package can have much smaller size. If your application requires a specific and non-latest Api-Version, it's recommended to pin this package to the previous released version; If your application always only use latest Api-Version, please ingore this change.

## 6.4.0 (2023-03-20)

Expand Down
6 changes: 0 additions & 6 deletions sdk/digitaltwins/azure-mgmt-digitaltwins/assets.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "6.5.0"
VERSION = "7.0.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-e ../../../tools/azure-sdk-tools
-e ../../identity/azure-identity
-e ../../resources/azure-mgmt-msi
-e ../../resources/azure-mgmt-resource
aiohttp
8 changes: 5 additions & 3 deletions sdk/digitaltwins/azure-mgmt-digitaltwins/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

# Version extraction inspired from 'requests'
with open(
os.path.join(package_folder_path, "version.py")
if os.path.exists(os.path.join(package_folder_path, "version.py"))
else os.path.join(package_folder_path, "_version.py"),
(
os.path.join(package_folder_path, "version.py")
if os.path.exists(os.path.join(package_folder_path, "version.py"))
else os.path.join(package_folder_path, "_version.py")
),
"r",
) as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
Expand Down
78 changes: 33 additions & 45 deletions sdk/digitaltwins/azure-mgmt-digitaltwins/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import platform
import pytest
import sys

from dotenv import load_dotenv

from devtools_testutils import test_proxy, add_general_regex_sanitizer, remove_batch_sanitizers
from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer

# Ignore async tests for Python < 3.5
collect_ignore_glob = []
if sys.version_info < (3, 5) or platform.python_implementation() == "PyPy":
collect_ignore_glob.append("*_async.py")
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)

load_dotenv()


# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000")
azuredigitaltwinsmanagement_subscription_id = os.environ.get(
"AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
)
azuredigitaltwinsmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
azuredigitaltwinsmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
azuredigitaltwinsmanagement_client_secret = os.environ.get(
"AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=azuredigitaltwinsmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=azuredigitaltwinsmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=azuredigitaltwinsmanagement_client_id, value="00000000-0000-0000-0000-000000000000"
)
add_general_regex_sanitizer(
regex=azuredigitaltwinsmanagement_client_secret, value="00000000-0000-0000-0000-000000000000"
)

add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

# Remove the following sanitizers since certain fields are needed in tests and are non-sensitive:
# - AZSDK3493: $..name
remove_batch_sanitizers(["AZSDK3493"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.digitaltwins.aio import AzureDigitalTwinsManagementClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async

AZURE_LOCATION = "eastus"


@pytest.mark.live_test_only
class TestAzureDigitalTwinsManagementDigitalTwinsOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(AzureDigitalTwinsManagementClient, is_async=True)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.digital_twins.list()
result = [r async for r in response]
assert response

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list_by_resource_group(self, resource_group):
response = self.client.digital_twins.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r async for r in response]
assert result == []
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy

AZURE_LOCATION = "eastus"


@pytest.mark.live_test_only
class TestAzureDigitalTwinsManagementDigitalTwinsOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(AzureDigitalTwinsManagementClient)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.digital_twins.list()
result = [r for r in response]
assert response

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list_by_resource_group(self, resource_group):
response = self.client.digital_twins.list_by_resource_group(
resource_group_name=resource_group.name,
)
result = [r for r in response]
assert result == []
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.digitaltwins.aio import AzureDigitalTwinsManagementClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
from devtools_testutils.aio import recorded_by_proxy_async

AZURE_LOCATION = "eastus"


@pytest.mark.live_test_only
class TestAzureDigitalTwinsManagementOperationsAsync(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(AzureDigitalTwinsManagementClient, is_async=True)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.operations.list()
result = [r async for r in response]
assert result
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.digitaltwins import AzureDigitalTwinsManagementClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy

AZURE_LOCATION = "eastus"


@pytest.mark.live_test_only
class TestAzureDigitalTwinsManagementOperations(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.client = self.create_mgmt_client(AzureDigitalTwinsManagementClient)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.operations.list()
result = [r for r in response]
assert result
Loading