city_config_third_test.go 744 B

12345678910111213141516171819202122232425262728293031
  1. package third
  2. import (
  3. "context"
  4. "go-template/business/dto"
  5. "testing"
  6. )
  7. // make test test_func=Test_cityConfigThird_CityInfo test_pkg=./business/third/
  8. func Test_cityConfigThird_CityInfo(t *testing.T) {
  9. t.Run("测试成功调用", func(t *testing.T) {
  10. resp, err := NewCityConfigThird().CityInfo(context.Background(), &dto.CityInfoParams{
  11. CityId: 1,
  12. })
  13. if err != nil {
  14. t.Fatal(err)
  15. }
  16. if resp == nil {
  17. t.Fatal("未获取到结果")
  18. }
  19. t.Logf("获取结果: %+v", resp)
  20. })
  21. t.Run("测试失败调用", func(t *testing.T) {
  22. _, err := NewCityConfigThird().CityInfo(context.Background(), &dto.CityInfoParams{
  23. CityId: 0,
  24. })
  25. if err != nil {
  26. t.Logf("调用失败测试成功,失败信息: %+v", err)
  27. }
  28. })
  29. }