Tests[CreateUser]
This commit is contained in:
@@ -1,50 +1,44 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestWebserver(t *testing.T) {
|
||||
ws, stop := NewSimpleWebserver()
|
||||
ws, stop := StartSimpleWebserver(t)
|
||||
defer stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
fmt.Printf("Port := %s\n", ws.Port)
|
||||
}
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
ws, stop := NewSimpleWebserver()
|
||||
ws, stop := StartSimpleWebserver(t)
|
||||
defer stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
||||
|
||||
_ = requestGet[Void](baseUrl, "/api/ping")
|
||||
_ = requestPut[Void](baseUrl, "/api/ping", nil)
|
||||
_ = requestPost[Void](baseUrl, "/api/ping", nil)
|
||||
_ = requestPatch[Void](baseUrl, "/api/ping", nil)
|
||||
_ = requestDelete[Void](baseUrl, "/api/ping", nil)
|
||||
_ = 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)
|
||||
}
|
||||
|
||||
func TestMongo(t *testing.T) {
|
||||
ws, stop := NewSimpleWebserver()
|
||||
ws, stop := StartSimpleWebserver(t)
|
||||
defer stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
||||
|
||||
_ = requestPost[Void](baseUrl, "/api/db-test", nil)
|
||||
_ = requestPost[Void](t, baseUrl, "/api/db-test", nil)
|
||||
}
|
||||
|
||||
func TestHealth(t *testing.T) {
|
||||
ws, stop := NewSimpleWebserver()
|
||||
ws, stop := StartSimpleWebserver(t)
|
||||
defer stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
||||
|
||||
_ = requestGet[Void](baseUrl, "/api/health")
|
||||
_ = requestGet[Void](t, baseUrl, "/api/health")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user