예제 #1
0
 def test_avatar(self):
     u = User(username='******', email='*****@*****.**')
     avatar = u.avatar(128)
     expected = 'http://www.gravatar.com/avatar/d4c74594d841139328695756648b6bd6'
     assert avatar[0:len(expected)] == expected
예제 #2
0
 def test_check_password(self):
     user = User.create(username="******", email="*****@*****.**",
                        password="******")
     assert user.check_password('foobarbaz123') is True
     assert user.check_password("barfoobaz") is False
예제 #3
0
 def test_password_is_nullable(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert user.password is None
예제 #4
0
 def test_created_at_defaults_to_datetime(self):
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert bool(user.created_at)
     assert isinstance(user.created_at, dt.datetime)
예제 #5
0
    def test_get_by_id(self):
        user = User('foo', '*****@*****.**')
        user.save()

        retrieved = User.get_by_id(user.id)
        assert retrieved == user
예제 #6
0
파일: views.py 프로젝트: xenith/xenith.org
def load_user(id):
    return User.get_by_id(int(id))