2023-06-12 11:52:11 +00:00
|
|
|
package logic_test
|
2023-06-12 09:10:27 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/474420502/requests"
|
2023-06-12 11:52:11 +00:00
|
|
|
"github.com/tidwall/gjson"
|
2023-06-12 09:10:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestCaseAddressList(t *testing.T) {
|
2023-06-12 11:52:11 +00:00
|
|
|
var err error
|
|
|
|
var resp *requests.Response
|
|
|
|
var result gjson.Result
|
2023-06-12 09:10:27 +00:00
|
|
|
|
2023-06-12 11:52:11 +00:00
|
|
|
ses := GetSesssionWithJwtToken(t, gserver)
|
2023-06-12 09:10:27 +00:00
|
|
|
|
2023-06-12 11:52:11 +00:00
|
|
|
resp, err = ses.Get(fmt.Sprintf("http://%s:%d/user/address-list", cnf.Host, cnf.Port)).TestInServer(gserver)
|
2023-06-12 09:10:27 +00:00
|
|
|
if err != nil {
|
2023-06-12 10:08:34 +00:00
|
|
|
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")
|
2023-06-12 09:10:27 +00:00
|
|
|
}
|
|
|
|
|
2023-06-12 10:08:34 +00:00
|
|
|
result = resp.Json().Get("msg")
|
|
|
|
if !result.Exists() {
|
|
|
|
t.Error("msg is not exists")
|
|
|
|
}
|
|
|
|
if result.String() != "success" {
|
|
|
|
t.Error(result.String())
|
|
|
|
}
|
2023-06-12 09:10:27 +00:00
|
|
|
}
|