Add tests and more docs

This commit is contained in:
Arti Zirk 2020-10-08 19:47:53 +03:00
parent 7fa907699d
commit ea3d617e9c
3 changed files with 21 additions and 1 deletions

View File

@ -16,8 +16,16 @@
## Run dev server ## Run dev server
source venv/bin/activate source venv/bin/activate
python -m kdoorweb
Or
bottle.py --debug --reload kdoorweb:application bottle.py --debug --reload kdoorweb:application
To set the TCP port number add it as the last argument
python -m kdoorweb 8888
## Run unittests ## Run unittests
source venv/bin/activate source venv/bin/activate

View File

@ -238,7 +238,7 @@ def initdb():
pass pass
DB.create_db(dbfile) DB.create_db(dbfile)
db = DB(dbfile) db = DB(dbfile)
db.add_users(db.import_ad("../ad.json")) db.add_users(db.import_ad("ad.json"))
users = db.list_users() users = db.list_users()
for user in users: for user in users:
print(dict(user)) print(dict(user))

12
kdoorweb/tests/test_db.py Normal file
View File

@ -0,0 +1,12 @@
import unittest
from kdoorweb.db import DB
class TestDB(unittest.TestCase):
def test_create_db_in_memory(self):
DB.create_db(dbfile=":memory:")
if __name__ == '__main__':
unittest.main()