From 6a185e2939649fe45219598dfb779cb6120cb7fa Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 17 Jul 2013 19:22:58 +0530 Subject: [PATCH] CLOUDSTACK-3592: Fix project email reference. Emails belong to user's within accounts. Refer to the first user within the account and use his email for account invites. Signed-off-by: Prasanna Santhanam (cherry picked from commit 22cb5be8b6e38fb9e27f86e264c6438e10192311) --- test/integration/component/test_projects.py | 28 ++++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py index 5f37f96804e..39e9bee433c 100644 --- a/test/integration/component/test_projects.py +++ b/test/integration/component/test_projects.py @@ -170,8 +170,7 @@ class TestMultipleProjectCreation(cloudstackTestCase): @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"]) def test_01_create_multiple_projects_by_account(self): - """ Verify an account can own multiple projects and can belong to - multiple projects + """ Verify an account can own multiple projects and can belong to multiple projects """ # Validate the following # 1. Create multiple project. Verify at step 1 An account is allowed @@ -245,22 +244,27 @@ class TestMultipleProjectCreation(cloudstackTestCase): "Check list project response returns a valid project" ) + self.assert_(isinstance(self.user.user, list)) + self.assert_(len(self.user.user) > 0, msg="Account %s has no users" % self.user.name) + self.debug("Adding account %s to project with email %s" % (self.user.name, self.user.user[0].email)) + email = self.user.user[0].email + # Add user to the project project_1.addAccount( self.apiclient, self.user.name, - self.user.email + email ) # listProjectAccount to verify the user is added to project or not - accounts_reponse = Project.listAccounts( + accounts_response = Project.listAccounts( self.apiclient, projectid=project_1.id, account=self.user.name, ) - self.debug(accounts_reponse) + self.debug(accounts_response) self.assertEqual( - isinstance(accounts_reponse, list), + isinstance(accounts_response, list), True, "Check for a valid list accounts response" ) @@ -270,7 +274,7 @@ class TestMultipleProjectCreation(cloudstackTestCase): 0, "Check list project response returns a valid project" ) - account = accounts_reponse[0] + account = accounts_response[0] self.assertEqual( account.role, @@ -281,18 +285,18 @@ class TestMultipleProjectCreation(cloudstackTestCase): project_2.addAccount( self.apiclient, self.user.name, - self.user.email + email ) # listProjectAccount to verify the user is added to project or not - accounts_reponse = Project.listAccounts( + accounts_response = Project.listAccounts( self.apiclient, projectid=project_2.id, account=self.user.name, ) - self.debug(accounts_reponse) + self.debug(accounts_response) self.assertEqual( - isinstance(accounts_reponse, list), + isinstance(accounts_response, list), True, "Check for a valid list accounts response" ) @@ -302,7 +306,7 @@ class TestMultipleProjectCreation(cloudstackTestCase): 0, "Check list project response returns a valid project" ) - account = accounts_reponse[0] + account = accounts_response[0] self.assertEqual( account.role,