fusenapi/server/home-user-auth/test/useraddresslistlogic_test.go

38 lines
717 B
Go
Raw Normal View History

2023-06-12 11:52:11 +00:00
package logic_test
import (
"fmt"
"testing"
"github.com/474420502/requests"
2023-06-12 11:52:11 +00:00
"github.com/tidwall/gjson"
)
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 11:52:11 +00:00
ses := GetSesssionWithJwtToken(t, gserver)
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)
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 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())
}
}