Skip to content

Commit 6a185e2

Browse files
author
Prasanna Santhanam
committed
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 <tsp@apache.org> (cherry picked from commit 22cb5be)
1 parent 8e7c1aa commit 6a185e2

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

‎test/integration/component/test_projects.py‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ def tearDown(self):
170170

171171
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
172172
def test_01_create_multiple_projects_by_account(self):
173-
""" Verify an account can own multiple projects and can belong to
174-
multiple projects
173+
""" Verify an account can own multiple projects and can belong to multiple projects
175174
"""
176175
# Validate the following
177176
# 1. Create multiple project. Verify at step 1 An account is allowed
@@ -245,22 +244,27 @@ def test_01_create_multiple_projects_by_account(self):
245244
"Check list project response returns a valid project"
246245
)
247246

247+
self.assert_(isinstance(self.user.user, list))
248+
self.assert_(len(self.user.user) > 0, msg="Account %s has no users" % self.user.name)
249+
self.debug("Adding account %s to project with email %s" % (self.user.name, self.user.user[0].email))
250+
email = self.user.user[0].email
251+
248252
# Add user to the project
249253
project_1.addAccount(
250254
self.apiclient,
251255
self.user.name,
252-
self.user.email
256+
email
253257
)
254258

255259
# listProjectAccount to verify the user is added to project or not
256-
accounts_reponse = Project.listAccounts(
260+
accounts_response = Project.listAccounts(
257261
self.apiclient,
258262
projectid=project_1.id,
259263
account=self.user.name,
260264
)
261-
self.debug(accounts_reponse)
265+
self.debug(accounts_response)
262266
self.assertEqual(
263-
isinstance(accounts_reponse, list),
267+
isinstance(accounts_response, list),
264268
True,
265269
"Check for a valid list accounts response"
266270
)
@@ -270,7 +274,7 @@ def test_01_create_multiple_projects_by_account(self):
270274
0,
271275
"Check list project response returns a valid project"
272276
)
273-
account = accounts_reponse[0]
277+
account = accounts_response[0]
274278

275279
self.assertEqual(
276280
account.role,
@@ -281,18 +285,18 @@ def test_01_create_multiple_projects_by_account(self):
281285
project_2.addAccount(
282286
self.apiclient,
283287
self.user.name,
284-
self.user.email
288+
email
285289
)
286290

287291
# listProjectAccount to verify the user is added to project or not
288-
accounts_reponse = Project.listAccounts(
292+
accounts_response = Project.listAccounts(
289293
self.apiclient,
290294
projectid=project_2.id,
291295
account=self.user.name,
292296
)
293-
self.debug(accounts_reponse)
297+
self.debug(accounts_response)
294298
self.assertEqual(
295-
isinstance(accounts_reponse, list),
299+
isinstance(accounts_response, list),
296300
True,
297301
"Check for a valid list accounts response"
298302
)
@@ -302,7 +306,7 @@ def test_01_create_multiple_projects_by_account(self):
302306
0,
303307
"Check list project response returns a valid project"
304308
)
305-
account = accounts_reponse[0]
309+
account = accounts_response[0]
306310

307311
self.assertEqual(
308312
account.role,

0 commit comments

Comments
 (0)