package ip_tool import ( "log" "testing" ) func TestHuaChenIpClient_GetIpInfo(t *testing.T) { type fields struct { AppCode string Host string } type args struct { ip string } tests := []struct { name string fields fields args args wantRes *ApiResult wantErr bool }{ { name: "test1", fields: fields{ AppCode: "", Host: "https://c2ba.api.huachen.cn", }, args: args{ ip: "8.138.116.112", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { h := &HuaChenIpClient{ AppCode: tt.fields.AppCode, Host: tt.fields.Host, } gotRes, err := h.GetIpInfo(tt.args.ip) log.Println(gotRes, err) }) } }