package third import ( "context" "go-template/business/dto" "testing" ) // make test test_func=Test_cityConfigThird_CityInfo test_pkg=./business/third/ func Test_cityConfigThird_CityInfo(t *testing.T) { t.Run("测试成功调用", func(t *testing.T) { resp, err := NewCityConfigThird().CityInfo(context.Background(), &dto.CityInfoParams{ CityId: 1, }) if err != nil { t.Fatal(err) } if resp == nil { t.Fatal("未获取到结果") } t.Logf("获取结果: %+v", resp) }) t.Run("测试失败调用", func(t *testing.T) { _, err := NewCityConfigThird().CityInfo(context.Background(), &dto.CityInfoParams{ CityId: 0, }) if err != nil { t.Logf("调用失败测试成功,失败信息: %+v", err) } }) }