26 lines
427 B
Go
26 lines
427 B
Go
|
package test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestWebserver(t *testing.T) {
|
||
|
ws := NewSimpleWebserver(t)
|
||
|
defer ws.Stop()
|
||
|
go func() { ws.Run() }()
|
||
|
time.Sleep(100 * time.Millisecond)
|
||
|
}
|
||
|
|
||
|
func TestPing(t *testing.T) {
|
||
|
ws := NewSimpleWebserver(t)
|
||
|
defer ws.Stop()
|
||
|
go func() { ws.Run() }()
|
||
|
time.Sleep(100 * time.Millisecond)
|
||
|
|
||
|
baseUrl := "http://127.0.0.1:" + ws.Port
|
||
|
|
||
|
_ = requestGet[struct{}](t, baseUrl, "/api/ping")
|
||
|
|
||
|
}
|