@@ -87,14 +87,20 @@ def __init__(self):
87
87
)
88
88
89
89
def create_resource (self , name , ** kwargs ):
90
- text_analytics_account = TextAnalyticsTest ._TEXT_ANALYTICS_ACCOUNT
91
-
92
- return {
93
- 'location' : 'westus2' ,
94
- 'resource_group' : TextAnalyticsTest ._RESOURCE_GROUP ,
95
- 'text_analytics_account' : text_analytics_account ,
96
- 'text_analytics_account_key' : TextAnalyticsTest ._TEXT_ANALYTICS_KEY ,
97
- }
90
+ if self .is_live :
91
+ return {
92
+ 'location' : 'westus2' ,
93
+ 'resource_group' : TextAnalyticsTest ._RESOURCE_GROUP ,
94
+ 'text_analytics_account' : os .environ ['AZURE_TEXT_ANALYTICS_ENDPOINT' ],
95
+ 'text_analytics_account_key' : os .environ ['AZURE_TEXT_ANALYTICS_KEY' ],
96
+ }
97
+ else :
98
+ return {
99
+ 'location' : 'westus2' ,
100
+ 'resource_group' : TextAnalyticsTest ._RESOURCE_GROUP ,
101
+ 'text_analytics_account' : "https://westus2.ppe.cognitiveservices.azure.com" ,
102
+ 'text_analytics_account_key' : "fake_key" ,
103
+ }
98
104
99
105
class TextAnalyticsClientPreparer (AzureMgmtPreparer ):
100
106
def __init__ (self , client_cls , client_kwargs = {}, ** kwargs ):
@@ -129,15 +135,15 @@ def create_text_analytics_client(self, **kwargs):
129
135
def text_analytics_account ():
130
136
test_case = AzureTestCase ("__init__" )
131
137
rg_preparer = ResourceGroupPreparer (random_name_enabled = True , name_prefix = 'pycog' )
132
- text_analytics_preparer = CognitiveServicesAccountPreparer (random_name_enabled = True , name_prefix = 'pycog' , sku = 'S0' )
138
+ text_analytics_preparer = CognitiveServicesAccountPreparer (random_name_enabled = True , name_prefix = 'pycog' )
133
139
134
140
try :
135
141
rg_name , rg_kwargs = rg_preparer ._prepare_create_resource (test_case )
136
142
TextAnalyticsTest ._RESOURCE_GROUP = rg_kwargs ['resource_group' ]
137
143
try :
138
144
text_analytics_name , text_analytics_kwargs = text_analytics_preparer ._prepare_create_resource (test_case , ** rg_kwargs )
139
- TextAnalyticsTest ._TEXT_ANALYTICS_ACCOUNT = os . environ [ 'AZURE_TEXT_ANALYTICS_ENDPOINT' ] # text_analytics_kwargs['cognitiveservices_account']
140
- TextAnalyticsTest ._TEXT_ANALYTICS_KEY = os . environ [ 'AZURE_TEXT_ANALYTICS_KEY' ] # text_analytics_kwargs['cognitiveservices_account_key']
145
+ TextAnalyticsTest ._TEXT_ANALYTICS_ACCOUNT = text_analytics_kwargs ['cognitiveservices_account' ]
146
+ TextAnalyticsTest ._TEXT_ANALYTICS_KEY = text_analytics_kwargs ['cognitiveservices_account_key' ]
141
147
yield
142
148
finally :
143
149
text_analytics_preparer .remove_resource (
0 commit comments