def test_user_class(): user = User('User') assert user.username == 'User' assert user.get_id() == 'User' assert user.password_hash is None same_username_user = User('User', 'other invalid hash') assert user == same_username_user assert same_username_user.password_hash == 'other invalid hash' assert user.__str__() == 'User' assert user.__repr__() == "<class 'manufactorum.users.User'> 'User'"
def test_user_password(): user = User('This is me') assert user.check_password('badpassword') is False user.set_password('badpassword') assert '$rounds=' in user.password_hash assert user.check_password('badpassword') is True assert user.check_password('wrongpassword') is False