restructure for docker

This commit is contained in:
Ville Rantanen
2023-07-24 20:02:45 +03:00
parent 79780f0769
commit 58abf04d2c
45 changed files with 152 additions and 17 deletions

24
forum/test/all.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
SQLITE=sqlite3
FLASK=flask
set -e
set -x
tmp=$(mktemp -d)
trap 'rm -rf $tmp' EXIT
base=$(dirname "$0")
db=$tmp/forum.db
. $base/../venv/bin/activate
# initialize db
$base/../init_sqlite.sh $db --no-admin
$SQLITE $db < $base/init_db.txt
cd $base/..
export DB=$db
export SERVER=dev
$FLASK --app main --debug run $TEST_FLASK_ARGS

33
forum/test/init_db.txt Normal file
View File

@@ -0,0 +1,33 @@
insert into users (name, password, join_time) values (
"foo",
-- supasecret
"$argon2id$v=19$m=65536,t=3,p=4$qBWCEAKgdA4BYOy915qzlg$KhGy3UF0QMlplt2eB7r7QNL2kDcggXUimRWUrWql8sI",
0
);
insert into users (name, password, join_time) values (
"bar",
-- abraca
"$argon2id$v=19$m=65536,t=3,p=4$klJKCUFoDaF07j3nPCeEUA$lCphd5n1YIs8MaVop2vGNirwknkh91qJIZHMuBOlgWA",
0
);
insert into users (name, password, join_time, role) values (
"bazzers",
-- e
"$argon2id$v=19$m=65536,t=3,p=4$9v5fS2ktxTinNEbIGUOoFQ$LMdEuAuuTCJ7utOE88+nXn7o6R/DEKY8ZA6wV+YkVGQ",
0,
2
);
insert into forums (name, description)
values ("Earth", "The totality of all space and time; all that is, has been, and will be.");
insert into threads (author_id, forum_id, create_time, modify_time, update_time, title, text)
values (1, 1, 0, 0, 0, "Hello, world!",
'In its most general sense, the term "world" refers to the totality of entities, to the whole of reality or to everything that is.');
insert into comments (author_id, thread_id, create_time, modify_time, text)
values (2, 1, 0, 0, "Hi!");
insert into comments (author_id, thread_id, create_time, modify_time, text, parent_id)
values (3, 1, 0, 0, "Greetings.", 1);
update config set registration_enabled = 1;