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
|
# 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.
# --------------------------------------------------------------------------
# covered ops:
# operations: 1/1
# subscriptions: 3/3
# tenants: 1/1
import unittest
import azure.mgmt.resource
from devtools_testutils import AzureMgmtRecordedTestCase, recorded_by_proxy
import pytest
@pytest.mark.live_test_only
class TestMgmtResourceSubscriptions(AzureMgmtRecordedTestCase):
def setup_method(self, method):
self.subscriptions_client = self.create_mgmt_client(azure.mgmt.resource.SubscriptionClient)
@recorded_by_proxy
def test_subscriptions(self):
subs = list(self.subscriptions_client.subscriptions.list())
assert len(subs) >= 0
# [ZIM] temporarily disabled
# assert all(isinstance(v, azure.mgmt.resource.subscriptions.models.Subscription) for v in subs)
subscription_id = self.get_settings_value("SUBSCRIPTION_ID")
locations = list(self.subscriptions_client.subscriptions.list_locations(subscription_id))
assert len(locations) >= 0
# [ZIM] temporarily disabled
# assert all(isinstance(v, azure.mgmt.resource.subscriptions.models.Location) for v in locations)
sub = self.subscriptions_client.subscriptions.get(subscription_id)
assert sub.subscription_id == subscription_id
@recorded_by_proxy
def test_tenants(self):
tenants = list(self.subscriptions_client.tenants.list())
assert len(tenants) >= 0
# [ZIM] temporarily disabled
# assert all(isinstance(v, azure.mgmt.resource.subscriptions.models.TenantIdDescription) for v in tenants)
@recorded_by_proxy
def test_operations(self):
self.subscriptions_client.operations.list()
# ------------------------------------------------------------------------------
if __name__ == "__main__":
unittest.main()
|