-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathmgmt_settings_fake.py
70 lines (58 loc) · 2.92 KB
/
mgmt_settings_fake.py
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
61
62
63
64
65
66
67
68
69
70
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
# Keyvault tests
# Note: Keyvault tests require EnvironmentCredential variables to be populated as well. (AZURE_CLIENT_ID etc)
TENANT_ID = "00000000-0000-0000-0000-000000000000"
# Note: Not the OID from the azure portal. Use 'az ad sp show --id <id> | grep objectId'
CLIENT_OID = "00000000-0000-0000-0000-000000000000"
# Cognitive Services tests
CS_SUBSCRIPTION_KEY = "0000000000000000000000000000"
# Event Grid key
EVENT_GRID_KEY = "0000000000000000000000000000"
# HDInsight tests
HDI_ADLS_ACCOUNT_NAME = "fakehdiadlsaccount"
HDI_ADLS_CLIENT_ID = "00000000-0000-0000-0000-000000000000"
# Ubuntu image
LINUX_OS_VHD = "https://mystorageaccount.blob.core.windows.net/inputtestdatadonotdelete/ubuntu.vhd"
# Storage tests related
ACTIVE_DIRECTORY_APPLICATION_ID = "00000000-0000-0000-0000-00000000000"
ACTIVE_DIRECTORY_APPLICATION_SECRET = "000000000ft5g5g5g5g5g5g5g5000000?"
ACTIVE_DIRECTORY_TENANT_ID = "00000000-0000-0000-0000-000000000000"
IS_SERVER_SIDE_FILE_ENCRYPTION_ENABLED = True
ENABLE_LOGGING = True
AZURE_STORAGE_CONNECTION_STRING = "DefaultEndpointsProtocol=https;AccountName=storagename;AccountKey=NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg==;EndpointSuffix=core.windows.net"
# Read for details of this file:
# https://github.com/Azure/azure-sdk-for-python/wiki/Contributing-to-the-tests
def get_azure_core_credentials(**kwargs):
# from azure.identity import ClientSecretCredential
# return ClientSecretCredential(
# client_id = '<AAD App client id>',
# client_secret = '<secret for the aad app>',
# tenant_id = '<microsoft aad tenant id>'
# )
# Needed to play recorded tests
from azure.core.credentials import AccessToken
class FakeCredential(object):
def get_token(self, *scopes, **kwargs):
return AccessToken("fake_token", 2527537086)
return FakeCredential()
def get_credentials(**kwargs):
from azure.common.credentials import BasicTokenAuthentication, UserPassCredentials
# Put your credentials here in the "real" file
# return UserPassCredentials(
# '[email protected]',
# 'Password'
# )
# note that UserCredential does not work any longer. Must use a ServicePrincipal.
# for deprecated APIs I believe will still work.
# return ServicePrincipalCredentials(
# client_id = '<AAD App client id>',
# secret = '<secret for the aad app>',
# tenant = '<microsoft aad tenant id>'
# )
# Needed to play recorded tests
return BasicTokenAuthentication(token={"access_token": "faked_token"})