first tests passing

This commit is contained in:
2018-07-15 10:50:05 +02:00
parent 4bba2167c1
commit 7d8532f5cf
3 changed files with 10 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
import os
from hashlib import sha256
import sqlite3
from server.registration import RegistrationServer
@@ -40,7 +42,7 @@ def build_dir(directory):
cursor.execute("CREATE TABLE confirmations_awaiting(" \
"user_id integer, " \
"convirmation_id integer PRIMARY KEY AUTOINCREMENT");
"convirmation_id integer PRIMARY KEY AUTOINCREMENT)")
db.commit()
cursor.execute("CREATE INDEX username ON users(username)")
@@ -107,11 +109,11 @@ def build_dir(directory):
create_private_db(directory)
create_public_db(directory)
with open("index.html", "w") as index:
with open(os.path.join(directory, "index.html"), "w") as index:
index.write("INDEX")
return {"database": {"users": directory + "private"},
"register": {"index": directory + "index.html",
return {"database": {"users": os.path.join(directory, "private")},
"register": {"index": os.path.join(directory, "index.html"),
"enabled": True}
}
@@ -125,5 +127,5 @@ def test_registration(tmpdir):
server = RegistrationServer(conf, mkhash)
assert server.index() == "INDEX"
assert server.index().read() == "INDEX"