[PATCH 02/25] tests: Remove use of global value
Stephen Finucane
stephen.finucane at intel.com
Fri Jun 24 07:53:23 AEST 2016
This isn't needed, so remove it.
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
patchwork/tests/utils.py | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py
index 37478b6..8bd0288 100644
--- a/patchwork/tests/utils.py
+++ b/patchwork/tests/utils.py
@@ -63,29 +63,29 @@ error_strings = {
'email': 'Enter a valid email address.',
}
-_user_idx = 1
-
def create_user():
- global _user_idx
- userid = 'test%d' % _user_idx
- email = '%s at example.com' % userid
- _user_idx += 1
+ _user_id = User.objects.count()
+
+ username = 'test%d' % _user_id
+ email = '%s at example.com' % username
- user = User.objects.create_user(userid, email, userid)
+ user = User.objects.create_user(username, email, username)
user.save()
- person = Person(email=email, name=userid, user=user)
+ person = Person(email=email, name=username, user=user)
person.save()
return user
def create_maintainer(project):
+ """Create a 'User' and set as maintainer for provided project."""
user = create_user()
profile = user.profile
profile.maintainer_projects.add(project)
profile.save()
+
return user
--
1.7.4.1
More information about the Patchwork
mailing list