TDD: 1, Me: 0
This commit is contained in:
19
tests/test_auth.py
Normal file
19
tests/test_auth.py
Normal 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
|
||||
Reference in New Issue
Block a user