| 1 |
# -------------------------------------------------------------------------------------------- |
| 2 |
# Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 |
# Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 |
# -------------------------------------------------------------------------------------------- |
| 5 |
|
| 6 |
"""This file contains the some helpers needed for the tests""" |
| 7 |
import string |
| 8 |
import random |
| 9 |
from azure.cli.core import get_default_cli |
| 10 |
from azure.cli.core._profile import Profile |
| 11 |
|
| 12 |
def get_credentials(): |
| 13 |
cli_ctx = get_default_cli() |
| 14 |
profile = Profile(cli_ctx=cli_ctx) |
| 15 |
creds, _, _ = profile.get_login_credentials(subscription_id=None) |
| 16 |
return creds |
| 17 |
|
| 18 |
def id_generator(size=10, chars=string.ascii_uppercase + string.digits): |
| 19 |
return ''.join(random.choice(chars) for _ in range(size)) |