flaschengeist/tests/test_auth.py

17 lines
528 B
Python

import pytest
# with app.app_context():
# engine = database.db.engine
# with engine.connect() as connection:
# connection.execute("")
def test_login_decorator(client):
"""Testing the login_required decorator"""
# No header at all
assert client.get("/auth").status_code == 401
# Invalid header
assert client.get("/auth", headers={"Authorization": "INVALID"}).status_code == 401
# Invalid Token
assert client.get("/auth", headers={"Authorization": "Bearer INVALID"}).status_code == 401