Skip to content

Commit

Permalink
add user authentication test
Browse files Browse the repository at this point in the history
  • Loading branch information
numerodix committed Jun 21, 2011
1 parent 638f549 commit c4c8214
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions django_couchdb_utils/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

from datetime import datetime, timedelta

from django.contrib import auth as core_auth

from django_couchdb_utils.auth import User
from django_couchdb_utils.sessions import Session, cleanup_sessions
from django_couchdb_utils.tests.utils import DbTester
Expand Down Expand Up @@ -53,6 +55,23 @@ def test_email_uniqueness(self):
self.assertExcMsg(Exception, 'This email address is already in use',
user2.save)

def test_user_authentication(self):
authdata = {
'username': 'mickey',
'password': 'secret',
}
data = authdata.copy()
data.update({
'email': 'mickey@mice.com',
})
user = User(**data)
user.set_password(data['password'])
user.save()

user = core_auth.authenticate(**authdata)

self.assertIsNotNone(user)


class SessionTests(DbTester):
def test_store_and_retrieve_session(self):
Expand Down

0 comments on commit c4c8214

Please sign in to comment.