topic_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package v1
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "testing"
  7. "go-common/app/interface/live/app-ucenter/api/http/v1"
  8. "go-common/library/net/metadata"
  9. . "github.com/smartystreets/goconvey/convey"
  10. "go-common/app/interface/live/app-ucenter/conf"
  11. )
  12. var topic *TopicService
  13. func init() {
  14. flag.Set("conf", "../../cmd/test.toml")
  15. if err := conf.Init(); err != nil {
  16. panic(err)
  17. }
  18. topic = NewTopicService(conf.Conf)
  19. }
  20. // group=qa01 DEPLOY_ENV=uat go test -run TestGetTopicList
  21. func TestGetTopicList(t *testing.T) {
  22. Convey("TestGetTopicList", t, func() {
  23. ctx := metadata.NewContext(context.TODO(), metadata.MD{
  24. metadata.Mid: int64(16299525),
  25. })
  26. res, err := topic.GetTopicList(ctx, &v1.GetTopicListReq{
  27. Platform: "ios",
  28. })
  29. fmt.Println(1111, res, err, 22222)
  30. t.Logf("%v,%s", res, err)
  31. So(err, ShouldBeNil)
  32. })
  33. }
  34. func TestCheckTopic(t *testing.T) {
  35. Convey("TestCheckTopic", t, func() {
  36. ctx := metadata.NewContext(context.TODO(), metadata.MD{
  37. metadata.Mid: int64(16299525),
  38. })
  39. res, err := topic.CheckTopic(ctx, &v1.CheckTopicReq{
  40. Platform: "ios",
  41. Topic: "我是习",
  42. })
  43. fmt.Println(1111, res, err, 22222)
  44. t.Logf("%v,%s", res, err)
  45. })
  46. }