1 Star 1 Fork 1

遛弯大爷/ex-engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main_test.go 904 Bytes
一键复制 编辑 原始数据 按行查看 历史
遛弯大爷 提交于 2021-07-28 17:53 . .
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)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/327630285/ex-engine.git
git@gitee.com:327630285/ex-engine.git
327630285
ex-engine
ex-engine
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385