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
update-testcase
  • Loading branch information
ChenxiJiang333 committed Nov 5, 2024
commit ff789f861fec7dcdade5a94da84f046d5dfeaba4
30 changes: 3 additions & 27 deletions sdk/managedservices/azure-mgmt-managedservices/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
# Release History

## 7.0.0 (2024-11-04)
## 7.0.0b2 (2024-11-05)

### Features Added

- Client `ManagedServicesClient` added operation group `operations_with_scope`
- Model `JustInTimeAccessPolicy` added property `managed_by_tenant_approvers`
- Model `RegistrationAssignment` added property `system_data`
- Model `RegistrationAssignmentPropertiesRegistrationDefinition` added property `system_data`
- Model `RegistrationDefinition` added property `system_data`
- Model `RegistrationDefinitionProperties` added property `managee_tenant_id`
- Model `RegistrationDefinitionProperties` added property `managee_tenant_name`
- Added enum `CreatedByType`
- Added model `EligibleApprover`
- Added model `SystemData`
- Model `MarketplaceRegistrationDefinitionsOperations` added parameter `kwargs` in method `__init__`
- Model `MarketplaceRegistrationDefinitionsWithoutScopeOperations` added parameter `kwargs` in method `__init__`
- Model `Operations` added parameter `kwargs` in method `__init__`
- Model `RegistrationAssignmentsOperations` added parameter `kwargs` in method `__init__`
- Model `RegistrationDefinitionsOperations` added parameter `kwargs` in method `__init__`
- Added model `OperationsWithScopeOperations`
- Method `RegistrationAssignmentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, scope: str, registration_assignment_id: str, request_body: RegistrationAssignment, content_type: str)`
- Method `RegistrationAssignmentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, scope: str, registration_assignment_id: str, request_body: IO[bytes], content_type: str)`
- Method `RegistrationDefinitionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, registration_definition_id: str, scope: str, request_body: RegistrationDefinition, content_type: str)`
- Method `RegistrationDefinitionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, registration_definition_id: str, scope: str, request_body: IO[bytes], content_type: str)`

### Breaking Changes
### Other Changes

- Method `ManagedServicesClient.__init__` parameter `base_url` changed default value from `None` to `str`
- Method `JustInTimeAccessPolicy.__init__` parameter `maximum_activation_duration` changed default value from `None` to `str`
- Update dependencies

## 7.0.0b1 (2022-10-31)

Expand Down
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 = "7.0.0"
VERSION = "7.0.0b2"
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-sdk-tools
aiohttp
10 changes: 6 additions & 4 deletions sdk/managedservices/azure-mgmt-managedservices/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 All @@ -49,7 +51,7 @@
url="https://github.com/Azure/azure-sdk-for-python",
keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product
classifiers=[
"Development Status :: 5 - Production/Stable",
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
Expand Down
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 os
import pytest
from dotenv import load_dotenv
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):
managedservices_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
managedservices_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
managedservices_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
managedservices_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=managedservices_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=managedservices_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=managedservices_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=managedservices_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")
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 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.
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
import unittest
import time
import json
Expand All @@ -19,50 +19,50 @@ def setUp(self):
self.client = self.create_basic_client(ManagedServicesClient)

def test_managedservices_crud(self):
scope = 'subscriptions/00000000-0000-0000-0000-000000000000'
assignmentid = 'c0d5f994-63a1-484d-8c1e-a2ac825efd60'
definitionid = '8daec8c7-7567-47ff-9009-f0a4ec429a3c'
regdef_string='{"registrationDefinitionName":"Registration Test","description":"dpp","managedByTenantId":"bab3375b-6197-4a15-a44b-16c41faa91d7","authorizations":[{"principalId":"d6f6c88a-5b7a-455e-ba40-ce146d4d3671","roleDefinitionId":"acdd72a7-3385-48ef-bd42-f606fba81ae7"}]}'
scope = "subscriptions/00000000-0000-0000-0000-000000000000"
assignmentid = "c0d5f994-63a1-484d-8c1e-a2ac825efd60"
definitionid = "8daec8c7-7567-47ff-9009-f0a4ec429a3c"
regdef_string = '{"registrationDefinitionName":"Registration Test","description":"dpp","managedByTenantId":"bab3375b-6197-4a15-a44b-16c41faa91d7","authorizations":[{"principalId":"d6f6c88a-5b7a-455e-ba40-ce146d4d3671","roleDefinitionId":"acdd72a7-3385-48ef-bd42-f606fba81ae7"}]}'
properties = json.loads((regdef_string))

#create definition
# create definition
poller = self.client.registration_definitions.create_or_update(definitionid, scope, properties)
response = poller.result()
self.assertIsNotNone(response)
self.assertEqual(definitionid, response.name)

#create assignment
# create assignment
definition = scope + "/providers/Microsoft.ManagedServices/registrationDefinitions/" + definitionid
assignmentproperties = {"registrationDefinitionId":definition}
assignmentproperties = {"registrationDefinitionId": definition}
poller = self.client.registration_assignments.create_or_update(scope, assignmentid, assignmentproperties)
response = poller.result()
self.assertIsNotNone(response)
self.assertEqual(assignmentid, response.name)

#get definition
response = self.client.registration_definitions.get(scope = scope, registration_definition_id = definitionid)
# get definition
response = self.client.registration_definitions.get(scope=scope, registration_definition_id=definitionid)
self.assertEqual(definitionid, response.name)

#get assignment
response = self.client.registration_assignments.get(scope = scope, registration_assignment_id = assignmentid)
# get assignment
response = self.client.registration_assignments.get(scope=scope, registration_assignment_id=assignmentid)
self.assertEqual(assignmentid, response.name)

#remove assignment
# remove assignment
self.client.registration_assignments.delete(scope, assignmentid).wait()

#remove definition
# remove definition
self.client.registration_definitions.delete(definitionid, scope)

#list assignments
# list assignments
assignments = self.client.registration_assignments.list(scope)
for assignment in assignments:
self.assertNotEqual(assignmentid, assignment.name)

#list definitions
# list definitions
definitions = self.client.registration_definitions.list(scope)
for definition in definitions:
self.assertNotEqual(definitionid, definition.name)


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
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.managedservices.aio import ManagedServicesClient

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

AZURE_LOCATION = "eastus"


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

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = self.client.marketplace_registration_definitions_without_scope.list()
result = [r async for r in response]
assert response
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.managedservices import ManagedServicesClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy

AZURE_LOCATION = "eastus"


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

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.marketplace_registration_definitions_without_scope.list()
result = [r for r in response]
assert response
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.managedservices.aio import ManagedServicesClient

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

AZURE_LOCATION = "eastus"


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

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
async def test_list(self, resource_group):
response = await self.client.operations.list()

assert response.value
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.managedservices import ManagedServicesClient

from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy

AZURE_LOCATION = "eastus"


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

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
def test_list(self, resource_group):
response = self.client.operations.list()

assert response.value