aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael McVady <femtonaut@gmail.com>2023-02-19 11:57:08 -0600
committerMichael McVady <femtonaut@gmail.com>2023-02-19 11:57:08 -0600
commit011e8d8870a6c14674e5e389bfdc09dae62b948d (patch)
tree44d3fcd211ad2348326c2b78b66c20d9d7add948
parent9092c94ee231e99dc31b1b265179866a404614e4 (diff)
Clean up
-rwxr-xr-xrun-local.sh8
-rw-r--r--src/clog.c6
-rw-r--r--src/init.c7
-rwxr-xr-xtests.py4
4 files changed, 13 insertions, 12 deletions
diff --git a/run-local.sh b/run-local.sh
new file mode 100755
index 0000000..458de5d
--- /dev/null
+++ b/run-local.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env sh
+
+set -a
+. ./.env
+set +a
+
+make
+make run
diff --git a/src/clog.c b/src/clog.c
index 5754955..af51155 100644
--- a/src/clog.c
+++ b/src/clog.c
@@ -521,11 +521,7 @@ int sql_render_posts(struct kore_pgsql *sql, struct post_query *pq) {
}
int
-sql_insert_posts(
- const char *id,
- const char *title,
- const char *body
-) {
+sql_insert_posts(const char *id, const char *title, const char *body) {
int err = KORE_RESULT_OK;
struct kore_pgsql sql;
diff --git a/src/init.c b/src/init.c
index 3208796..c6697ee 100644
--- a/src/init.c
+++ b/src/init.c
@@ -69,11 +69,8 @@ init_db(void) {
// Register the database
pg_config = kore_buf_stringify(pg_config_buf, NULL);
- kore_log(LOG_INFO, "%s", pg_config);
- err = kore_pgsql_register(
- database,
- pg_config
- );
+ // kore_log(LOG_DEBUG, "%s", pg_config);
+ err = kore_pgsql_register(database, pg_config);
kore_buf_free(pg_config_buf);
diff --git a/tests.py b/tests.py
index 89b980d..f07b397 100755
--- a/tests.py
+++ b/tests.py
@@ -18,6 +18,7 @@ JSON_ACCEPT_HEADER = {"Accept": "application/json"}
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
+
def test_redirect():
url = f"{BASE_URL}/asdf"
r = requests.get(url, allow_redirects=False)
@@ -100,8 +101,7 @@ def test_json_get_posts():
def test_json_post_posts():
url = f"{BASE_URL}/posts"
- uuid_ = str(uuid.uuid4())
- data = {"id": uuid_, "title": "title", "body": "body"}
+ data = {"id": str(uuid.uuid4()), "title": "title", "body": "body"}
r = requests.post(url, headers=JSON_ACCEPT_HEADER, json=data)
assert r.status_code == 201
j = r.json()