Skip to content

Commit

Permalink
Check if user exist and raise helpfull message
Browse files Browse the repository at this point in the history
  • Loading branch information
jedie committed Jun 17, 2015
1 parent 352f232 commit 357845a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_tools/unittest_utils/unittest_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def login(self, usertype):
"""
test_user = self._get_userdata(usertype)

count = User.objects.filter(username=test_user["username"]).count()
self.failIfEqual(count, 0, "You have to call self.create_testusers() first!")
self.failUnlessEqual(count, 1)

ok = self.client.login(username=test_user["username"],
password=test_user["password"])
self.failUnless(ok, "Can't login test user '%s'!" % usertype)
Expand Down

0 comments on commit 357845a

Please sign in to comment.