1616class Authv2ScenarioTest (ScenarioTest ):
1717
1818 @ResourceGroupPreparer (name_prefix = 'cli_test_authV2' )
19+ @AllowLargeResponse ()
1920 def test_authV2_clientsecret_param_combinations (self , resource_group ):
2021 webapp_name = self .create_random_name ('webapp-authentication-test' , 40 )
2122 plan_name = self .create_random_name ('webapp-authentication-plan' , 40 )
2223 self .cmd (
23- 'appservice plan create -g {} -n {} --sku S1' .format (resource_group , plan_name ))
24+ 'appservice plan create -g {} -n {} --sku S1 --location westus2 ' .format (resource_group , plan_name ))
2425 self .cmd (
2526 'webapp create -g {} -n {} --plan {}' .format (resource_group , webapp_name , plan_name ))
2627 self .cmd ('webapp auth config-version show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
@@ -29,13 +30,15 @@ def test_authV2_clientsecret_param_combinations(self, resource_group):
2930
3031 # testing show command for newly created app and initial fields
3132 self .cmd ('webapp auth show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
32- JMESPathCheck ('properties' , {} )
33+ JMESPathCheck ('properties.platform.enabled ' , False )
3334 ])
35+ self .cmd ('webapp auth config-version upgrade -g {} -n {}' .format (resource_group , webapp_name ))
3436
3537 # # update and verify
3638 self .cmd ('webapp auth update -g {} -n {} --enabled true --runtime-version 1.2.8'
3739 .format (resource_group , webapp_name )).assert_with_checks ([
38- JMESPathCheck ('platform' , "{'enabled': True, 'runtimeVersion': '1.2.8'}" )
40+ JMESPathCheck ('platform.enabled' , True ),
41+ JMESPathCheck ('platform.runtimeVersion' , '1.2.8' )
3942 ])
4043
4144 with self .assertRaisesRegex (ArgumentUsageError , 'Usage Error: --client-secret and --client-secret-setting-name cannot both be '
@@ -79,11 +82,12 @@ def test_authV2_clientsecret_param_combinations(self, resource_group):
7982 .format (resource_group , webapp_name ))
8083
8184 @ResourceGroupPreparer (name_prefix = 'cli_test_authV2' )
85+ @AllowLargeResponse ()
8286 def test_authV2_auth (self , resource_group ):
8387 webapp_name = self .create_random_name ('webapp-authentication-test' , 40 )
8488 plan_name = self .create_random_name ('webapp-authentication-plan' , 40 )
8589 self .cmd (
86- 'appservice plan create -g {} -n {} --sku S1' .format (resource_group , plan_name ))
90+ 'appservice plan create -g {} -n {} --sku S1 --location westus2 ' .format (resource_group , plan_name ))
8791 self .cmd (
8892 'webapp create -g {} -n {} --plan {}' .format (resource_group , webapp_name , plan_name ))
8993 self .cmd ('webapp auth config-version show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
@@ -92,22 +96,26 @@ def test_authV2_auth(self, resource_group):
9296
9397 # testing show command for newly created app and initial fields
9498 self .cmd ('webapp auth show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
95- JMESPathCheck ('properties' , {} )
99+ JMESPathCheck ('properties.platform.enabled ' , False )
96100 ])
101+
102+ self .cmd ('webapp auth config-version upgrade -g {} -n {}' .format (resource_group , webapp_name ))
97103
98104 # # update and verify
99105 self .cmd ('webapp auth update -g {} -n {} --enabled true --runtime-version 1.2.8'
100106 .format (resource_group , webapp_name )).assert_with_checks ([
101- JMESPathCheck ('platform' , "{'enabled': True, 'runtimeVersion': '1.2.8'}" )
107+ JMESPathCheck ('platform.enabled' , True ),
108+ JMESPathCheck ('platform.runtimeVersion' , '1.2.8' )
102109 ])
103110
104111
105112 @ResourceGroupPreparer (name_prefix = 'cli_test_authV2' )
113+ @AllowLargeResponse ()
106114 def test_authV2_authclassic (self , resource_group ):
107115 webapp_name = self .create_random_name ('webapp-authentication-test' , 40 )
108116 plan_name = self .create_random_name ('webapp-authentication-plan' , 40 )
109117 self .cmd (
110- 'appservice plan create -g {} -n {} --sku S1' .format (resource_group , plan_name ))
118+ 'appservice plan create -g {} -n {} --sku S1 --location westus2 ' .format (resource_group , plan_name ))
111119 self .cmd (
112120 'webapp create -g {} -n {} --plan {}' .format (resource_group , webapp_name , plan_name ))
113121 self .cmd ('webapp auth config-version show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
@@ -154,3 +162,57 @@ def test_authV2_authclassic(self, resource_group):
154162 JMESPathCheck ('facebookAppId' , 'facebook_id' )]).get_output_in_json ()
155163
156164 self .assertIn ('https://audience1' , result ['allowedAudiences' ])
165+
166+ @ResourceGroupPreparer (name_prefix = 'cli_test_authV2' )
167+ @AllowLargeResponse ()
168+ def test_authV2_excluded_paths_parsing (self , resource_group ):
169+ webapp_name = self .create_random_name ('webapp-authentication-test' , 40 )
170+ plan_name = self .create_random_name ('webapp-authentication-plan' , 40 )
171+ self .cmd (
172+ 'appservice plan create -g {} -n {} --sku S1 --location westus2' .format (resource_group , plan_name ))
173+ self .cmd (
174+ 'webapp create -g {} -n {} --plan {}' .format (resource_group , webapp_name , plan_name ))
175+ self .cmd ('webapp auth config-version show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
176+ JMESPathCheck ('configVersion' , 'v1' )
177+ ])
178+
179+ self .cmd ('webapp auth show -g {} -n {}' .format (resource_group , webapp_name )).assert_with_checks ([
180+ JMESPathCheck ('properties.platform.enabled' , False )
181+ ])
182+ self .cmd ('webapp auth config-version upgrade -g {} -n {}' .format (resource_group , webapp_name ))
183+
184+ # # update and verify
185+ # test single path
186+ self .cmd ('webapp auth update -g {} -n {} --enabled true --excluded-paths "/health"'
187+ .format (resource_group , webapp_name )).assert_with_checks ([
188+ JMESPathCheck ('platform.enabled' , True ),
189+ JMESPathCheck ('globalValidation.excludedPaths[0]' , '/health' )
190+ ])
191+
192+ # test multiple comma separated paths
193+ self .cmd ('webapp auth update -g {} -n {} --excluded-paths "/health,/status,/metrics"'
194+ .format (resource_group , webapp_name )).assert_with_checks ([
195+ JMESPathCheck ('globalValidation.excludedPaths[0]' , '/health' ),
196+ JMESPathCheck ('globalValidation.excludedPaths[1]' , '/status' ),
197+ JMESPathCheck ('globalValidation.excludedPaths[2]' , '/metrics' )
198+ ])
199+
200+ # test JSON array format
201+ self .cmd ('webapp auth update -g {} -n {} --excluded-paths \' ["/api/health", "/api/status"]\' '
202+ .format (resource_group , webapp_name )).assert_with_checks ([
203+ JMESPathCheck ('globalValidation.excludedPaths[0]' , '/api/health' ),
204+ JMESPathCheck ('globalValidation.excludedPaths[1]' , '/api/status' )
205+ ])
206+
207+ # test paths with special characters
208+ self .cmd ('webapp auth update -g {} -n {} --excluded-paths "/api/v1/health,/webhook/callback"'
209+ .format (resource_group , webapp_name )).assert_with_checks ([
210+ JMESPathCheck ('globalValidation.excludedPaths[0]' , '/api/v1/health' ),
211+ JMESPathCheck ('globalValidation.excludedPaths[1]' , '/webhook/callback' )
212+ ])
213+
214+ # test single path without leading slash
215+ self .cmd ('webapp auth update -g {} -n {} --excluded-paths "public"'
216+ .format (resource_group , webapp_name )).assert_with_checks ([
217+ JMESPathCheck ('globalValidation.excludedPaths[0]' , 'public' )
218+ ])
0 commit comments