package ali_auth import ( "fmt" "reflect" "testing" ) func TestRealAuth(t *testing.T) { type args struct { name string mobile string id string } tests := []struct { name string args args wantResult AuthResult }{ {name: "t1", args: struct { name string mobile string id string }{name: "123", mobile: "", id: "234"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotResult, e := RealAuth(tt.args.name, tt.args.mobile, tt.args.id) fmt.Printf("%++v %+v\n", gotResult, e) }) } } func TestRealAuthSimple(t *testing.T) { type args struct { name string id string } tests := []struct { name string args args wantResult AuthSimpleResult wantErr bool }{ {name: "t1", args: struct { name string id string }{name: "", id: ""}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotResult, err := RealAuthSimple(tt.args.name, tt.args.id) if (err != nil) != tt.wantErr { t.Errorf("RealAuthSimple() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(gotResult, tt.wantResult) { t.Errorf("RealAuthSimple() = %v, want %v", gotResult, tt.wantResult) } }) } } func TestRealAuthSimpleV2(t *testing.T) { v2, err := RealAuthSimpleV2("", "") if err != nil { t.Error(err) } println(v2.Data.Address) }