Example #1
0
    def test_get_by_id(self):
        """Get user by ID."""
        user = User('foo', '*****@*****.**')
        user.save()

        retrieved = User.get_by_id(user.id)
        assert retrieved == user
Example #2
0
 def test_check_password(self):
     """Check password."""
     user = User.create(username='******', email='*****@*****.**',
                        password='******')
     assert user.check_password('foobarbaz123') is True
     assert user.check_password('barfoobaz') is False
Example #3
0
 def test_password_is_nullable(self):
     """Test null password."""
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert user.password is None
Example #4
0
 def test_created_at_defaults_to_datetime(self):
     """Test creation date."""
     user = User(username='******', email='*****@*****.**')
     user.save()
     assert bool(user.created_at)
     assert isinstance(user.created_at, dt.datetime)