55
66from azure .cli .testsdk import ScenarioTest , ResourceGroupPreparer
77from .utils import ApicServicePreparer , ApicApiPreparer , ApicMetadataPreparer
8+ from .constants import TEST_REGION
89
910class ApiCommandsTests (ScenarioTest ):
1011
11- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
12+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
1213 @ApicServicePreparer ()
1314 def test_api_create (self ):
1415 self .kwargs .update ({
@@ -23,7 +24,7 @@ def test_api_create(self):
2324 self .check ('externalDocumentation' , [])
2425 ])
2526
26- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
27+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
2728 @ApicServicePreparer ()
2829 @ApicMetadataPreparer ()
2930 def test_api_create_with_all_optional_params (self , metadata_name ):
@@ -46,7 +47,7 @@ def test_api_create_with_all_optional_params(self, metadata_name):
4647 self .check ('summary' , 'summary' )
4748 ])
4849
49- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
50+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
5051 @ApicServicePreparer ()
5152 @ApicApiPreparer ()
5253 def test_api_show (self ):
@@ -59,7 +60,7 @@ def test_api_show(self):
5960 self .check ('externalDocumentation' , [])
6061 ])
6162
62- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
63+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
6364 @ApicServicePreparer ()
6465 @ApicApiPreparer (parameter_name = 'api_id1' )
6566 @ApicApiPreparer (parameter_name = 'api_id2' )
@@ -70,7 +71,7 @@ def test_api_list(self, api_id1, api_id2):
7071 self .check ('@[1].name' , api_id2 )
7172 ])
7273
73- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
74+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
7475 @ApicServicePreparer ()
7576 @ApicApiPreparer (parameter_name = 'api_id1' )
7677 @ApicApiPreparer (parameter_name = 'api_id2' )
@@ -83,15 +84,15 @@ def test_api_list_with_all_optional_params(self, api_id1):
8384 self .check ('@[0].name' , api_id1 ),
8485 ])
8586
86- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
87+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
8788 @ApicServicePreparer ()
8889 @ApicApiPreparer ()
8990 def test_api_update (self ):
9091 self .cmd ('az apic api update -g {rg} -n {s} --api-id {api} --title "Echo API 2"' , checks = [
9192 self .check ('title' , 'Echo API 2' ),
9293 ])
9394
94- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
95+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
9596 @ApicServicePreparer ()
9697 @ApicApiPreparer ()
9798 @ApicMetadataPreparer ()
@@ -113,14 +114,14 @@ def test_api_update_with_all_optional_params(self, metadata_name):
113114 self .check ('summary' , 'summary' )
114115 ])
115116
116- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
117+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
117118 @ApicServicePreparer ()
118119 @ApicApiPreparer ()
119120 def test_api_delete (self ):
120121 self .cmd ('az apic api delete -g {rg} -n {s} --api-id {api} --yes' )
121122 self .cmd ('az apic api show -g {rg} -n {s} --api-id {api}' , expect_failure = True )
122123
123- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
124+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
124125 @ApicServicePreparer ()
125126 def test_examples_create_api (self ):
126127 self .kwargs .update ({
@@ -132,7 +133,7 @@ def test_examples_create_api(self):
132133 self .check ('title' , 'Echo API' ),
133134 ])
134135
135- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
136+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
136137 @ApicServicePreparer ()
137138 @ApicMetadataPreparer ()
138139 def test_examples_create_api_with_custom_properties (self , metadata_name ):
@@ -147,14 +148,14 @@ def test_examples_create_api_with_custom_properties(self, metadata_name):
147148 self .check ('customProperties.{}' .format (metadata_name ), True ),
148149 ])
149150
150- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
151+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
151152 @ApicServicePreparer ()
152153 @ApicApiPreparer ()
153154 def test_examples_delete_api (self ):
154155 self .cmd ('az apic api delete -g {rg} -n {s} --api-id {api} --yes' )
155156 self .cmd ('az apic api show -g {rg} -n {s} --api-id {api}' , expect_failure = True )
156157
157- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
158+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
158159 @ApicServicePreparer ()
159160 @ApicApiPreparer (parameter_name = 'api_id1' )
160161 @ApicApiPreparer (parameter_name = 'api_id2' )
@@ -165,7 +166,7 @@ def test_examples_list_apis(self, api_id1, api_id2):
165166 self .check ('@[1].name' , api_id2 )
166167 ])
167168
168- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
169+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
169170 @ApicServicePreparer ()
170171 @ApicApiPreparer ()
171172 def test_examples_show_api_details (self ):
@@ -175,15 +176,15 @@ def test_examples_show_api_details(self):
175176 self .check ('title' , 'Echo API' ),
176177 ])
177178
178- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
179+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
179180 @ApicServicePreparer ()
180181 @ApicApiPreparer ()
181182 def test_examples_update_api (self ):
182183 self .cmd ('az apic api update -g {rg} -n {s} --api-id {api} --summary "Basic REST API service"' , checks = [
183184 self .check ('summary' , 'Basic REST API service' ),
184185 ])
185186
186- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
187+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
187188 @ApicServicePreparer ()
188189 @ApicApiPreparer ()
189190 @ApicMetadataPreparer ()
@@ -195,7 +196,7 @@ def test_examples_update_custom_properties(self, metadata_name):
195196 self .check ('customProperties.{}' .format (metadata_name ), True ),
196197 ])
197198
198- @ResourceGroupPreparer (name_prefix = "clirg" , location = 'eastus' , random_name_length = 32 )
199+ @ResourceGroupPreparer (name_prefix = "clirg" , location = TEST_REGION , random_name_length = 32 )
199200 @ApicServicePreparer ()
200201 @ApicApiPreparer (parameter_name = 'api_id1' )
201202 @ApicApiPreparer (parameter_name = 'api_id2' )
0 commit comments