summaryrefslogtreecommitdiff
path: root/api/dns/dns_test.go
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth@simponic.xyz>2024-04-03 17:53:50 -0600
committerElizabeth Hunt <elizabeth@simponic.xyz>2024-04-03 17:53:50 -0600
commitf38e8719c2a8537fe9b64ed8ceca45858a58e498 (patch)
tree5cf2c7c7f6396f75bdb841db00638e4eef8e81e8 /api/dns/dns_test.go
parente398cf05402c010d594cea4e2dea307ca1a36dbe (diff)
downloadhatecomputers.club-f38e8719c2a8537fe9b64ed8ceca45858a58e498.tar.gz
hatecomputers.club-f38e8719c2a8537fe9b64ed8ceca45858a58e498.zip
make it compile
Diffstat (limited to 'api/dns/dns_test.go')
-rw-r--r--api/dns/dns_test.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/api/dns/dns_test.go b/api/dns/dns_test.go
new file mode 100644
index 0000000..cc56120
--- /dev/null
+++ b/api/dns/dns_test.go
@@ -0,0 +1,63 @@
+package dns_test
+
+import (
+ "database/sql"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "testing"
+
+ // "git.hatecomputers.club/hatecomputers/hatecomputers.club/api/dns"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/api/types"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/args"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/database"
+ "git.hatecomputers.club/hatecomputers/hatecomputers.club/utils"
+)
+
+func IdContinuation(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain {
+ return func(success types.Continuation, _failure types.Continuation) types.ContinuationChain {
+ return success(context, req, resp)
+ }
+}
+
+func setup() (*sql.DB, *types.RequestContext, func()) {
+ randomDb := utils.RandomId()
+
+ testDb := database.MakeConn(&randomDb)
+ database.Migrate(testDb)
+
+ context := &types.RequestContext{
+ DBConn: testDb,
+ Args: &args.Arguments{},
+ TemplateData: &(map[string]interface{}{}),
+ }
+
+ return testDb, context, func() {
+ testDb.Close()
+ os.Remove(randomDb)
+ }
+}
+
+func TestThatOwnerCanPutRecordInDomain(t *testing.T) {
+ db, context, cleanup := setup()
+ defer cleanup()
+
+ _ = &database.User{
+ ID: "test",
+ Username: "test",
+ }
+
+ records, err := database.GetUserDNSRecords(db, context.User.ID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(records) > 0 {
+ t.Errorf("expected no records, got records")
+ }
+
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ // dns.CreateDNSRecordContinuation(context, r, w)(IdContinuation, IdContinuation)
+ }))
+ defer ts.Close()
+
+}