From f0afd178293b2466078cc093b1d05daa10c8ad12 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 22 Aug 2024 14:03:21 +0200 Subject: [PATCH 1/2] test: fix component tests test_acl_isolatednetwork and test_acl_isolatednetwork_delete --- .../component/test_acl_isolatednetwork.py | 14 +++++++------- .../component/test_acl_isolatednetwork_delete.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/integration/component/test_acl_isolatednetwork.py b/test/integration/component/test_acl_isolatednetwork.py index 038fd3589720..8a352a06539d 100644 --- a/test/integration/component/test_acl_isolatednetwork.py +++ b/test/integration/component/test_acl_isolatednetwork.py @@ -524,7 +524,7 @@ def test_07_createNetwork_domaindmin_forcrossdomainuser(self): self.fail("Domain admin is allowed to create network for users not in their domain ") except Exception as e: self.debug("When Domain admin tries to create network for users in their sub domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Domain admin tries to create network for users not in their domain ") ## Test cases relating to createNetwork as regular user @@ -799,7 +799,7 @@ def test_17_deployvm_domaindmin_forcrossdomainuser(self): self.fail("Domain admin is allowed to deploy vm for users not in hos domain ") except Exception as e: self.debug("When Domain admin tries to deploy vm for users in their sub domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Domain admin tries to deploy vm for users not in hos domain ") @attr("simulator_only", tags=["advanced"], required_hardware="false") @@ -876,7 +876,7 @@ def test_19_deployvm_user_foruserinsamedomain(self): self.fail("Regular user is allowed to deploy vm for other users in their domain ") except Exception as e: self.debug("When user tries to deploy vm for users in their domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Regular user tries to deploy vm for other users in their domain ") @attr("simulator_only", tags=["advanced"], required_hardware="false") @@ -903,7 +903,7 @@ def test_20_deployvm_user_foruserincrossdomain(self): self.fail("Regular user is allowed to deploy vm for users not in their domain ") except Exception as e: self.debug("When user tries to deploy vm for users n different domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Regular user tries to deploy vm for users not in their domain ") @attr("simulator_only", tags=["advanced"], required_hardware="false") @@ -1030,7 +1030,7 @@ def test_27_restartNetwork_domaindmin_forcrossdomainuser(self): self.fail("Domain admin is allowed to restart network for users not in their domain ") except Exception as e: self.debug("When Domain admin tries to restart network for users in their sub domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Domain admin tries to restart network for users not in their domain ") ## Test cases relating restart network as regular user @@ -1061,7 +1061,7 @@ def test_29_restartNetwork_user_foruserinsamedomain(self): self.fail("Regular user is allowed to restart network for users in their domain ") except Exception as e: self.debug("When user tries to restart network for users in their domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Regular user tries to restart network for users in their domain ") @attr("simulator_only", tags=["advanced"], required_hardware="false") @@ -1077,7 +1077,7 @@ def test_30_restartNetwork_user_foruserinotherdomain(self): self.fail("Regular user is allowed to restart network for users not in their domain ") except Exception as e: self.debug("When user tries to restart network for users in other domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Regular user is allowed to restart network for users not in their domain ") @staticmethod diff --git a/test/integration/component/test_acl_isolatednetwork_delete.py b/test/integration/component/test_acl_isolatednetwork_delete.py index a8c4b67557ea..6781dccad668 100644 --- a/test/integration/component/test_acl_isolatednetwork_delete.py +++ b/test/integration/component/test_acl_isolatednetwork_delete.py @@ -455,7 +455,7 @@ def test_deleteNetwork_domaindmin_forcrossdomainuser(self): self.fail("Domain admin is allowed to delete network for users not in their domain ") except Exception as e: self.debug ("When Domain admin tries to delete network for user in a different domain %s" %e) - if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN): + if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Domain admin tries to delete network for users not in their domain ") ## Test cases relating deleting network as regular user @@ -490,7 +490,7 @@ def test_deleteNetwork_user_foruserinsamedomain(self): self.fail("Regular user is allowed to delete network for users in their domain ") except Exception as e: self.debug ("When user tries to delete network for users in their domain %s" %e) - if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Regular user is allowed to delete network for users in their domain ") @attr("simulator_only",tags=["advanced"],required_hardware="false") @@ -508,7 +508,7 @@ def test_deleteNetwork_user_foruserinotherdomain(self): self.fail("Regular user is allowed to delete network for users not in their domain ") except Exception as e: self.debug ("When user tries to delete network for users in other domain %s" %e) - if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): + if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): self.fail("Error message validation failed when Regular user tries to delete network for users not in their domain ") @staticmethod From 35ae107f2f651719de8c07b8c81873cd7deec65a Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 22 Aug 2024 15:51:22 +0200 Subject: [PATCH 2/2] Update test/integration/component/test_acl_isolatednetwork.py --- test/integration/component/test_acl_isolatednetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/component/test_acl_isolatednetwork.py b/test/integration/component/test_acl_isolatednetwork.py index 8a352a06539d..8397171bcc6c 100644 --- a/test/integration/component/test_acl_isolatednetwork.py +++ b/test/integration/component/test_acl_isolatednetwork.py @@ -524,7 +524,7 @@ def test_07_createNetwork_domaindmin_forcrossdomainuser(self): self.fail("Domain admin is allowed to create network for users not in their domain ") except Exception as e: self.debug("When Domain admin tries to create network for users in their sub domain %s" % e) - if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_SOURCE): + if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN): self.fail("Error message validation failed when Domain admin tries to create network for users not in their domain ") ## Test cases relating to createNetwork as regular user