From ea3d617e9c6831deea9458e422bd9eb5c67ffd27 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Thu, 8 Oct 2020 19:47:53 +0300 Subject: [PATCH] Add tests and more docs --- kdoorweb/README.md | 8 ++++++++ kdoorweb/kdoorweb/db.py | 2 +- kdoorweb/tests/test_db.py | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 kdoorweb/tests/test_db.py diff --git a/kdoorweb/README.md b/kdoorweb/README.md index 41718bb..7037cb1 100644 --- a/kdoorweb/README.md +++ b/kdoorweb/README.md @@ -16,8 +16,16 @@ ## Run dev server source venv/bin/activate + python -m kdoorweb + +Or + bottle.py --debug --reload kdoorweb:application +To set the TCP port number add it as the last argument + + python -m kdoorweb 8888 + ## Run unittests source venv/bin/activate diff --git a/kdoorweb/kdoorweb/db.py b/kdoorweb/kdoorweb/db.py index 70f3903..8a614e1 100644 --- a/kdoorweb/kdoorweb/db.py +++ b/kdoorweb/kdoorweb/db.py @@ -238,7 +238,7 @@ def initdb(): pass DB.create_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() for user in users: print(dict(user)) diff --git a/kdoorweb/tests/test_db.py b/kdoorweb/tests/test_db.py new file mode 100644 index 0000000..cf213db --- /dev/null +++ b/kdoorweb/tests/test_db.py @@ -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()