Unuse an undefined local variable 'name'.

trove/tests/utils/users.py: _find_user_by_condition
In expect code, the error message use an undefined
variable 'name' and this will raise a NameError.

Change-Id: I05cc16f865ef2ca73466aa165284975964680f8a
Closes-Bug: 1681309
This commit is contained in:
zhanggang 2017-04-11 04:09:15 -04:00
parent b09d0eb313
commit 4d0276d9d9
1 changed files with 2 additions and 1 deletions

View File

@ -118,7 +118,7 @@ class Users(object):
try:
user = min(users, key=lambda user: user.test_count)
except ValueError:
raise RuntimeError('Did not find a user with name "%s".' % name)
raise RuntimeError('Did not find a user with specified condition')
user.test_count += 1
return user
@ -128,5 +128,6 @@ class Users(object):
return self._find_user_by_condition(condition)
def find_user_by_tenant_id(self, tenant_id):
"""Finds a user who meets the requirements and has been used least."""
condition = lambda user: user.tenant_id == tenant_id
return self._find_user_by_condition(condition)