Example #1
0
    def test_user_authenticate_incorrect_password(self):
        import transaction
        from babytracker.models import DBSession, User

        with transaction.manager:
            session = DBSession()

            session.add(User(u'*****@*****.**', u'John Smith', 'secret'))
            session.add(User(u'*****@*****.**', u'Jill Smith', 'foobar'))

            user = User.authenticate(u'*****@*****.**', 'sikrit')
            self.assertEqual(user, None)
Example #2
0
    def test_user_authenticate_incorrect_password(self):
        import transaction
        from babytracker.models import DBSession, User

        with transaction.manager:
            session = DBSession()

            session.add(User(u"*****@*****.**", u"John Smith", "secret"))
            session.add(User(u"*****@*****.**", u"Jill Smith", "foobar"))

            user = User.authenticate(u"*****@*****.**", "sikrit")
            self.assertEqual(user, None)
Example #3
0
    def test_user_authenticate_success(self):
        import transaction
        from babytracker.models import DBSession, User

        with transaction.manager:
            session = DBSession()

            session.add(User(u'*****@*****.**', u'John Smith', 'secret'))
            session.add(User(u'*****@*****.**', u'Jill Smith', 'foobar'))

            user = User.authenticate(u'*****@*****.**', 'secret')
            self.assertEqual(user.__name__, u'*****@*****.**')
Example #4
0
    def test_user_authenticate_success(self):
        import transaction
        from babytracker.models import DBSession, User

        with transaction.manager:
            session = DBSession()

            session.add(User(u"*****@*****.**", u"John Smith", "secret"))
            session.add(User(u"*****@*****.**", u"Jill Smith", "foobar"))

            user = User.authenticate(u"*****@*****.**", "secret")
            self.assertEqual(user.__name__, u"*****@*****.**")