38 lines
717 B
Go
38 lines
717 B
Go
package logic_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/474420502/requests"
|
|
"github.com/tidwall/gjson"
|
|
)
|
|
|
|
func TestCaseAddressList(t *testing.T) {
|
|
var err error
|
|
var resp *requests.Response
|
|
var result gjson.Result
|
|
|
|
ses := GetSesssionWithJwtToken(t, gserver)
|
|
|
|
resp, err = ses.Get(fmt.Sprintf("http://%s:%d/user/address-list", cnf.Host, cnf.Port)).TestInServer(gserver)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
result = resp.Json().Get("code")
|
|
if !result.Exists() {
|
|
t.Error("code is not exists")
|
|
}
|
|
if result.Int() != 200 {
|
|
t.Error("code != 200")
|
|
}
|
|
|
|
result = resp.Json().Get("msg")
|
|
if !result.Exists() {
|
|
t.Error("msg is not exists")
|
|
}
|
|
if result.String() != "success" {
|
|
t.Error(result.String())
|
|
}
|
|
}
|