AiiTServices / tests /test_app.py
HenriqueBraz's picture
Create tests/test_app.py
5aee586 verified
raw
history blame contribute delete
496 Bytes
import pytest
import sqlite3
from app import init_db, load_users_from_db
def test_init_db():
init_db()
conn = sqlite3.connect('private/users.db')
cursor = conn.cursor()
cursor.execute("SELECT username FROM users WHERE username='admin'")
assert cursor.fetchone() is not None
conn.close()
def test_load_users():
config = load_users_from_db()
assert 'admin' in config['credentials']['usernames']