HenriqueBraz commited on
Commit
5aee586
·
verified ·
1 Parent(s): 44db12b

Create tests/test_app.py

Browse files
Files changed (1) hide show
  1. tests/test_app.py +15 -0
tests/test_app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ import sqlite3
3
+ from app import init_db, load_users_from_db
4
+
5
+ def test_init_db():
6
+ init_db()
7
+ conn = sqlite3.connect('private/users.db')
8
+ cursor = conn.cursor()
9
+ cursor.execute("SELECT username FROM users WHERE username='admin'")
10
+ assert cursor.fetchone() is not None
11
+ conn.close()
12
+
13
+ def test_load_users():
14
+ config = load_users_from_db()
15
+ assert 'admin' in config['credentials']['usernames']