summaryrefslogtreecommitdiff
path: root/api/auth_test.go
diff options
context:
space:
mode:
authorElizabeth <elizabeth@simponic.xyz>2024-04-03 16:22:19 -0600
committerElizabeth <elizabeth@simponic.xyz>2024-04-03 16:22:19 -0600
commite398cf05402c010d594cea4e2dea307ca1a36dbe (patch)
tree57a878b408a2066275fefb8058a43ec44d9bd223 /api/auth_test.go
parentb74a955dcb8cc1d5d2599a1b096510a60e55e7d7 (diff)
downloadhatecomputers.club-e398cf05402c010d594cea4e2dea307ca1a36dbe.tar.gz
hatecomputers.club-e398cf05402c010d594cea4e2dea307ca1a36dbe.zip
checkpoint to save work; had to get on the bus
Diffstat (limited to 'api/auth_test.go')
-rw-r--r--api/auth_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/api/auth_test.go b/api/auth_test.go
new file mode 100644
index 0000000..45ca12e
--- /dev/null
+++ b/api/auth_test.go
@@ -0,0 +1,37 @@
+package api_test
+
+import (
+ "database/sql"
+ "os"
+ "testing"
+
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/api"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/args"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/database"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/utils"
+)
+
+func setup() (*sql.DB, *api.RequestContext, func()) {
+ randomDb := utils.RandomId()
+
+ testDb := database.MakeConn(&randomDb)
+ database.Migrate(testDb)
+
+ context := &api.RequestContext{
+ DBConn: testDb,
+ Args: &args.Arguments{},
+ TemplateData: &(map[string]interface{}{}),
+ }
+
+ return testDb, context, func() {
+ testDb.Close()
+ os.Remove(randomDb)
+ }
+}
+
+/*
+todo: test api key creation
++ api key attached to user
++ user session is unique
++ goLogin goes to page in cookie
+*/