Skip to content

Commit 319c422

Browse files
committed
added test cases for etag and wait
1 parent 33f74b6 commit 319c422

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ def test_apim_policy_operations(self, resource_group, resource_group_location):
659659
'--specification-path {policy_specification_path} '
660660
'--policy-format {policy_specification_format}')
661661

662+
self.cmd('apim api wait -g "{rg}" -n "{service_name}" --api-id "{api_id}" --exists', checks=[self.is_empty()])
663+
662664
# Verify policies were updated
663665
current_policy_global = self.cmd('apim api policy list -g {rg} -n {service_name}').get_output_in_json()
664666
current_policy_api = self.cmd('apim api policy list -g {rg} -n {service_name} --api-id {api_id}').get_output_in_json()
@@ -680,11 +682,23 @@ def test_apim_policy_operations(self, resource_group, resource_group_location):
680682
self.cmd('apim api policy show -g {rg} -n {service_name} --api-id {api_id} --operation-id {operation_name}',
681683
checks=[self.check('format', '{policy_specification_format}')])
682684

685+
# Get etag
686+
etag_global = self.cmd('apim api policy get-etag -g {rg} -n {service_name}').get_output_in_json()
687+
etag_api = self.cmd('apim api policy get-etag -g {rg} -n {service_name} --api-id {api_id}').get_output_in_json()
688+
etag_operation = self.cmd('apim api policy get-etag -g {rg} -n {service_name} --api-id {api_id} --operation-id {operation_name}').get_output_in_json()
689+
690+
self.assertTrue(etag_global, "Global policy etag should not be empty")
691+
self.assertTrue(etag_api, "API policy etag should not be empty")
692+
self.assertTrue(etag_operation, "Operation policy etag should not be empty")
693+
683694
# Delete policies
684695
self.cmd('apim api policy delete -g {rg} -n {service_name} --yes')
685696
self.cmd('apim api policy delete -g {rg} -n {service_name} --api-id {api_id} --yes')
686697
self.cmd('apim api policy delete -g {rg} -n {service_name} --api-id {api_id} --operation-id {operation_name} --yes')
687698

699+
#wait
700+
self.cmd('apim api wait -g "{rg}" -n "{service_name}" --api-id "{api_id}" --deleted', checks=[self.is_empty()])
701+
688702
# Verify policies are deleted
689703
final_policy_global = self.cmd('apim api policy list -g {rg} -n {service_name}').get_output_in_json()
690704
final_policy_api = self.cmd('apim api policy list -g {rg} -n {service_name} --api-id {api_id}').get_output_in_json()
@@ -793,7 +807,7 @@ def test_apim_deletedservice(self, resource_group, resource_group_location):
793807
self.check('publisherName', '{publisher_name}'),
794808
self.check('publisherEmail', '{publisher_email}')])
795809

796-
# wait for creation
810+
# eaait for creation
797811
self.cmd('apim wait -g {rg} -n {service_name} --created', checks=[self.is_empty()])
798812

799813
# delete service

0 commit comments

Comments
 (0)