Files
WOL-LY/tests/test_auth.py
2024-12-13 18:08:44 +02:00

20 lines
632 B
Python

import sys
import os
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../app')))
from werkzeug.security import generate_password_hash
from auth import verify_password
from flask import Flask
@pytest.fixture
def app():
app = Flask(__name__)
app.config['USER_PASS_HASH'] = generate_password_hash('4acG2wHmp1-B')
return app
def test_verify_password(app):
with app.app_context():
assert verify_password('anon', '4acG2wHmp1-B') == 'anon'
assert verify_password('anon', 'wrongpassword') is None
assert verify_password('wronguser', '4acG2wHmp1-B') is None