You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/17 15:57:47 UTC

[2/4] git commit: updated refs/heads/4.2 to 6a185e2

CLOUDSTACK-2273: cleanup using user api client for domain admins

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 9f9510be9189346ed72ff92705d284de91d53c6f)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79009dbb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79009dbb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79009dbb

Branch: refs/heads/4.2
Commit: 79009dbba62cebdac715a0f29e7381030c5a0dd2
Parents: a13b8b4
Author: ashutoshkelkar <as...@clogeny.com>
Authored: Wed Jul 17 15:26:34 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed Jul 17 19:27:33 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_assign_vm.py | 29 +++++++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79009dbb/test/integration/component/test_assign_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_assign_vm.py b/test/integration/component/test_assign_vm.py
index 8bc98fe..55c174b 100644
--- a/test/integration/component/test_assign_vm.py
+++ b/test/integration/component/test_assign_vm.py
@@ -353,8 +353,11 @@ class TestVMOwnership(cloudstackTestCase):
         # 1. deploy VM in sub subdomain1
         # 2. stop VM in sub subdomain1
         # 3. assignVirtualMachine to subdomain2
+        userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
+                                                         domain=self.sdomain_account_user1['domain'].name,
+                                                         type=2)
         self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'])
-        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
 
     @attr(tags = ["advanced"])
     @log_test_exceptions
@@ -386,8 +389,11 @@ class TestVMOwnership(cloudstackTestCase):
         # Validate the following:
         # 1. deploy VM in sub subdomain1 with volumes.
         # 3. assignVirtualMachine to subdomain2
+        userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
+                                                         domain=self.sdomain_account_user1['domain'].name,
+                                                         type=2)
         self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],volume=self.sdomain_account_user1['volume'])
-        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
          # Check all volumes attached to same VM
         list_volume_response = list_volumes(self.apiclient,
                                             virtualmachineid=self.virtual_machine.id,
@@ -398,6 +404,8 @@ class TestVMOwnership(cloudstackTestCase):
                          "Check list volumes response for valid list")
 
         self.assertNotEqual(list_volume_response[0].domainid, self.sdomain_account_user2['domain'].id, "Volume ownership not changed.")
+        self.virtual_machine.detach_volume(self.apiclient,
+                                           self.sdomain_account_user1['volume'])
 
     @attr(tags = ["advanced"])
     @log_test_exceptions
@@ -423,8 +431,11 @@ class TestVMOwnership(cloudstackTestCase):
         # Validate the following:
         # 1. deploy VM in sub subdomain1 with snapshot.
         # 3. assignVirtualMachine to subdomain2
+        userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
+                                                         domain=self.sdomain_account_user1['domain'].name,
+                                                         type=2)
         self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], project=self.sdomain_account_user1['project'])
-        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
 
     @attr(tags = ["advanced"])
     @log_test_exceptions
@@ -439,8 +450,11 @@ class TestVMOwnership(cloudstackTestCase):
                               account=self.sdomain_account_user2['account'].name,
                               domainid=self.sdomain_account_user2['domain'].id,
                               max=0)
+        userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
+                                                         domain=self.sdomain_account_user1['domain'].name,
+                                                         type=2)
         self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True)
-        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
 
     @attr(tags = ["advanced"])
     @log_test_exceptions
@@ -456,5 +470,10 @@ class TestVMOwnership(cloudstackTestCase):
                               account=self.sdomain_account_user2['account'].name,
                               domainid=self.sdomain_account_user2['domain'].id,
                               max=0)
+        userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
+                                                         domain=self.sdomain_account_user1['domain'].name,
+                                                         type=2)
         self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True, volume=self.sdomain_account_user1['volume'])
-        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
+        self.virtual_machine.detach_volume(self.apiclient,
+                                            self.sdomain_account_user1['volume'])