代码拉取完成,页面将自动刷新
package main
import (
"ir/cmd"
"testing"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/httptest"
)
func TestNewApp(t *testing.T) {
app, _ := cmd.NewApp()
e := httptest.New(t, app)
// redirects to /admin without basic auth
e.GET("/api/ping").Expect().Status(httptest.StatusOK)
fd := map[string]interface{}{"side": 1, "account-id": 1, "symbol": "pear", "amount": 10, "price": 1}
e.POST("/api/order/create").WithForm(fd).Expect().Status(httptest.StatusOK)
}
func TestHandlerUsingNetHTTP(t *testing.T) {
handler := func(ctx iris.Context) {
ctx.WriteString("Hello, World!")
}
// A shortcut for net/http/httptest.NewRecorder/NewRequest.
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", nil)
httptest.Do(w, r, handler)
if expected, got := "Hello, World!", w.Body.String(); expected != got {
t.Fatalf("expected body: %s but got: %s", expected, got)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。