@@ -5,7 +5,6 @@ import (
|
|||||||
"github.com/buger/jsonparser"
|
"github.com/buger/jsonparser"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
@@ -20,16 +19,6 @@ func initTest() {
|
|||||||
PushConf.Core.Mode = "test"
|
PushConf.Core.Mode = "test"
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRequest(t *testing.T, url string) {
|
|
||||||
resp, err := http.Get(url)
|
|
||||||
defer resp.Body.Close()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
_, ioerr := ioutil.ReadAll(resp.Body)
|
|
||||||
assert.NoError(t, ioerr)
|
|
||||||
assert.Equal(t, "200 OK", resp.Status, "should get a 200")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPrintGoPushVersion(t *testing.T) {
|
func TestPrintGoPushVersion(t *testing.T) {
|
||||||
PrintGoPushVersion()
|
PrintGoPushVersion()
|
||||||
}
|
}
|
||||||
@@ -47,7 +36,7 @@ func TestRunNormalServer(t *testing.T) {
|
|||||||
time.Sleep(5 * time.Millisecond)
|
time.Sleep(5 * time.Millisecond)
|
||||||
|
|
||||||
assert.Error(t, router.Run(":8088"))
|
assert.Error(t, router.Run(":8088"))
|
||||||
testRequest(t, "http://localhost:8088/api/status")
|
gofight.TestRequest(t, "http://localhost:8088/api/status")
|
||||||
}
|
}
|
||||||
|
|
||||||
// func TestRunTLSServer(t *testing.T) {
|
// func TestRunTLSServer(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user