| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package dpsapi
- import (
- "git.sxidc.com/go-tools/api_binding/http_binding"
- "git.sxidc.com/go-tools/api_binding/http_binding/response"
- "github.com/go-resty/resty/v2"
- "testing"
- )
- func TestApiV1(t *testing.T) {
- http_binding.Init("test", "10086")
- defer http_binding.Destroy()
- binding := http_binding.NewBinding("v1")
- ApiV1(binding, "localhost:30170")
- result := new(response.MsgResponse)
- resp, err := resty.New().R().
- SetBody(&OperateFromRequest{
- DatabaseID: "ee2d7dabe56646ce835d80873348ee0e",
- Version: "v1",
- SQL: sqlSelect,
- }).
- SetResult(result).
- Post("http://localhost:10086/test/api/v1/dpsv1/database/operate")
- if err != nil {
- t.Fatal(err)
- }
- if resp.IsError() {
- t.Fatal(resp.Status())
- }
- if !result.Success {
- t.Fatal(result.Msg)
- }
- }
|