TDD: 1, Me: 0

This commit is contained in:
2024-12-13 18:08:44 +02:00
commit 9c1cfa7c23
36 changed files with 2374 additions and 0 deletions

19
tests/test_auth.py Normal file
View File

@@ -0,0 +1,19 @@
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