Tests[UpdateUsername, RecreateKeys, DeleteUser]

This commit is contained in:
2022-11-30 13:57:55 +01:00
parent 7f56dbdbfa
commit 7a11b2c76f
8 changed files with 600 additions and 348 deletions

View File

@@ -1,44 +1,45 @@
package test
import (
tt "blackforestbytes.com/simplecloudnotifier/test/util"
"fmt"
"testing"
)
func TestWebserver(t *testing.T) {
ws, stop := StartSimpleWebserver(t)
ws, stop := tt.StartSimpleWebserver(t)
defer stop()
fmt.Printf("Port := %s\n", ws.Port)
}
func TestPing(t *testing.T) {
ws, stop := StartSimpleWebserver(t)
ws, stop := tt.StartSimpleWebserver(t)
defer stop()
baseUrl := "http://127.0.0.1:" + ws.Port
_ = requestGet[Void](t, baseUrl, "/api/ping")
_ = requestPut[Void](t, baseUrl, "/api/ping", nil)
_ = requestPost[Void](t, baseUrl, "/api/ping", nil)
_ = requestPatch[Void](t, baseUrl, "/api/ping", nil)
_ = requestDelete[Void](t, baseUrl, "/api/ping", nil)
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/ping")
_ = tt.RequestPut[tt.Void](t, baseUrl, "/api/ping", nil)
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/ping", nil)
_ = tt.RequestPatch[tt.Void](t, baseUrl, "/api/ping", nil)
_ = tt.RequestDelete[tt.Void](t, baseUrl, "/api/ping", nil)
}
func TestMongo(t *testing.T) {
ws, stop := StartSimpleWebserver(t)
ws, stop := tt.StartSimpleWebserver(t)
defer stop()
baseUrl := "http://127.0.0.1:" + ws.Port
_ = requestPost[Void](t, baseUrl, "/api/db-test", nil)
_ = tt.RequestPost[tt.Void](t, baseUrl, "/api/db-test", nil)
}
func TestHealth(t *testing.T) {
ws, stop := StartSimpleWebserver(t)
ws, stop := tt.StartSimpleWebserver(t)
defer stop()
baseUrl := "http://127.0.0.1:" + ws.Port
_ = requestGet[Void](t, baseUrl, "/api/health")
_ = tt.RequestGet[tt.Void](t, baseUrl, "/api/health")
}