flaschengeist/tests/test_auth.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
528 B
Python
Raw Normal View History

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