update testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
425cea8346
commit
9221aa6de1
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue