From 011e8d8870a6c14674e5e389bfdc09dae62b948d Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Sun, 19 Feb 2023 11:57:08 -0600 Subject: Clean up --- run-local.sh | 8 ++++++++ src/clog.c | 6 +----- src/init.c | 7 ++----- tests.py | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) create mode 100755 run-local.sh 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() -- cgit v1.2.3