Basics to view threads
This commit is contained in:
22
test/all.sh
Executable file
22
test/all.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/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
|
||||
$SQLITE $db < $base/../schema.txt
|
||||
$SQLITE $db < $base/init_db.txt
|
||||
cd $base/..
|
||||
|
||||
DB=$db $FLASK --app main --debug run
|
||||
15
test/init_db.txt
Normal file
15
test/init_db.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
insert into users (name, password, email) values ("Foo", "supasecret", "foo@bar.baz");
|
||||
insert into users (name, password, email) values ("Bar", "rgjieogir", "bar@foo.baz");
|
||||
insert into users (name, password) values ("bazzers", "reogke");
|
||||
|
||||
insert into subforums (name, description, allowed_roles_mask)
|
||||
values ("Earth", "The totality of all space and time; all that is, has been, and will be.", 1);
|
||||
|
||||
insert into threads (author_id, forum_id, create_date, modify_date, update_date, 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_date, modify_date, text)
|
||||
values (2, 1, 0, 0, "Hi!");
|
||||
insert into comments (author_id, thread_id, create_date, modify_date, text, parent_id)
|
||||
values (3, 1, 0, 0, "Greetings.", 1);
|
||||
Reference in New Issue
Block a user