# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from azure.mgmt.containerinstance.aio import ContainerInstanceManagementClient

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

AZURE_LOCATION = "eastus"


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestContainerInstanceManagementNGroupsOperationsAsync(AzureMgmtRecordedTestCase):
    def setup_method(self, method):
        self.client = self.create_mgmt_client(ContainerInstanceManagementClient, is_async=True)

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_get(self, resource_group):
        response = await self.client.ngroups.get(
            resource_group_name=resource_group.name,
            ngroups_name="str",
        )

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_begin_create_or_update(self, resource_group):
        response = await (
            await self.client.ngroups.begin_create_or_update(
                resource_group_name=resource_group.name,
                ngroups_name="str",
                n_group={
                    "id": "str",
                    "identity": {
                        "principalId": "str",
                        "tenantId": "str",
                        "type": "str",
                        "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
                    },
                    "location": "str",
                    "name": "str",
                    "properties": {
                        "containerGroupProfiles": [
                            {
                                "containerGroupProperties": {
                                    "containers": [
                                        {
                                            "name": "str",
                                            "properties": {
                                                "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}]
                                            },
                                        }
                                    ],
                                    "subnetIds": [{"id": "str", "name": "str"}],
                                    "volumes": [
                                        {
                                            "name": "str",
                                            "azureFile": {
                                                "shareName": "str",
                                                "storageAccountName": "str",
                                                "readOnly": bool,
                                                "storageAccountKey": "str",
                                                "storageAccountKeyReference": "str",
                                            },
                                        }
                                    ],
                                },
                                "networkProfile": {
                                    "applicationGateway": {
                                        "backendAddressPools": [{"resource": "str"}],
                                        "resource": "str",
                                    },
                                    "loadBalancer": {"backendAddressPools": [{"resource": "str"}]},
                                },
                                "resource": {"id": "str"},
                                "revision": 0,
                                "storageProfile": {
                                    "fileShares": [
                                        {
                                            "name": "str",
                                            "properties": {"shareAccessTier": "str", "shareAccessType": "str"},
                                            "resourceGroupName": "str",
                                            "storageAccountName": "str",
                                        }
                                    ]
                                },
                            }
                        ],
                        "elasticProfile": {
                            "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}},
                            "desiredCount": 0,
                            "maintainDesiredCount": bool,
                        },
                        "placementProfile": {"faultDomainCount": 0},
                        "provisioningState": "str",
                        "updateProfile": {
                            "rollingUpdateProfile": {
                                "inPlaceUpdate": bool,
                                "maxBatchPercent": 0,
                                "maxUnhealthyPercent": 0,
                                "pauseTimeBetweenBatches": "str",
                            },
                            "updateMode": "str",
                        },
                    },
                    "systemData": {
                        "createdAt": "2020-02-20 00:00:00",
                        "createdBy": "str",
                        "createdByType": "str",
                        "lastModifiedAt": "2020-02-20 00:00:00",
                        "lastModifiedBy": "str",
                        "lastModifiedByType": "str",
                    },
                    "tags": {"str": "str"},
                    "type": "str",
                    "zones": ["str"],
                },
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_begin_update(self, resource_group):
        response = await (
            await self.client.ngroups.begin_update(
                resource_group_name=resource_group.name,
                ngroups_name="str",
                n_group={
                    "identity": {
                        "principalId": "str",
                        "tenantId": "str",
                        "type": "str",
                        "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
                    },
                    "properties": {
                        "containerGroupProfiles": [
                            {
                                "containerGroupProperties": {
                                    "containers": [
                                        {
                                            "name": "str",
                                            "properties": {
                                                "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}]
                                            },
                                        }
                                    ],
                                    "subnetIds": [{"id": "str", "name": "str"}],
                                    "volumes": [
                                        {
                                            "name": "str",
                                            "azureFile": {
                                                "shareName": "str",
                                                "storageAccountName": "str",
                                                "readOnly": bool,
                                                "storageAccountKey": "str",
                                                "storageAccountKeyReference": "str",
                                            },
                                        }
                                    ],
                                },
                                "networkProfile": {
                                    "applicationGateway": {
                                        "backendAddressPools": [{"resource": "str"}],
                                        "resource": "str",
                                    },
                                    "loadBalancer": {"backendAddressPools": [{"resource": "str"}]},
                                },
                                "resource": {"id": "str"},
                                "revision": 0,
                                "storageProfile": {
                                    "fileShares": [
                                        {
                                            "name": "str",
                                            "properties": {"shareAccessTier": "str", "shareAccessType": "str"},
                                            "resourceGroupName": "str",
                                            "storageAccountName": "str",
                                        }
                                    ]
                                },
                            }
                        ],
                        "elasticProfile": {
                            "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}},
                            "desiredCount": 0,
                            "maintainDesiredCount": bool,
                        },
                        "placementProfile": {"faultDomainCount": 0},
                        "provisioningState": "str",
                        "updateProfile": {
                            "rollingUpdateProfile": {
                                "inPlaceUpdate": bool,
                                "maxBatchPercent": 0,
                                "maxUnhealthyPercent": 0,
                                "pauseTimeBetweenBatches": "str",
                            },
                            "updateMode": "str",
                        },
                    },
                    "systemData": {
                        "createdAt": "2020-02-20 00:00:00",
                        "createdBy": "str",
                        "createdByType": "str",
                        "lastModifiedAt": "2020-02-20 00:00:00",
                        "lastModifiedBy": "str",
                        "lastModifiedByType": "str",
                    },
                    "tags": {"str": "str"},
                    "zones": ["str"],
                },
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_begin_delete(self, resource_group):
        response = await (
            await self.client.ngroups.begin_delete(
                resource_group_name=resource_group.name,
                ngroups_name="str",
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_list_by_resource_group(self, resource_group):
        response = self.client.ngroups.list_by_resource_group(
            resource_group_name=resource_group.name,
        )
        result = [r async for r in response]
        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_list(self, resource_group):
        response = self.client.ngroups.list()
        result = [r async for r in response]
        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_begin_start(self, resource_group):
        response = await (
            await self.client.ngroups.begin_start(
                resource_group_name=resource_group.name,
                ngroups_name="str",
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_stop(self, resource_group):
        response = await self.client.ngroups.stop(
            resource_group_name=resource_group.name,
            ngroups_name="str",
        )

        # please add some check logic here by yourself
        # ...

    @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
    @recorded_by_proxy_async
    async def test_ngroups_begin_restart(self, resource_group):
        response = await (
            await self.client.ngroups.begin_restart(
                resource_group_name=resource_group.name,
                ngroups_name="str",
            )
        ).result()  # call '.result()' to poll until service return final result

        # please add some check logic here by yourself
        # ...
