github.com/weplanx/server@v0.2.6-0.20240318110640-f7e75155779a/api/tencent/service_test.go (about) 1 package tencent_test 2 3 import ( 4 "context" 5 "github.com/stretchr/testify/assert" 6 "testing" 7 ) 8 9 func TestService_GetIpv4(t *testing.T) { 10 ctx := context.TODO() 11 dto, err := x.TencentX.GetIpv4(ctx, "119.41.34.152") 12 assert.NoError(t, err) 13 t.Log(dto) 14 15 } 16 17 func TestService_GetIpv4BadResp(t *testing.T) { 18 ctx := context.TODO() 19 _, err := x.TencentX.GetIpv4(ctx, "xa.41.34.152") 20 assert.Error(t, err) 21 } 22 23 func TestService_GetIpv6(t *testing.T) { 24 ctx := context.TODO() 25 dto, err := x.TencentX.GetIpv6(ctx, "240e:314:e441:9000:2d47:2c35:4fb:a883") 26 assert.NoError(t, err) 27 t.Log(dto) 28 }