mine_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package space
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-interface/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var s *Service
  12. func init() {
  13. dir, _ := filepath.Abs("../../cmd/app-interface-test.toml")
  14. flag.Set("conf", dir)
  15. conf.Init()
  16. s = New(conf.Conf)
  17. time.Sleep(3 * time.Second)
  18. }
  19. func Test_Mine(t *testing.T) {
  20. Convey("Test_Mine", t, func() {
  21. mine, err := s.Mine(context.Background(), 16840123, "ios", "", 0, 0)
  22. So(err, ShouldBeNil)
  23. for _, s := range mine.Sections {
  24. Printf("%+v\n", s.Title)
  25. for _, item := range s.Items {
  26. Printf("%+v\n", item.Title)
  27. }
  28. }
  29. })
  30. }
  31. func Test_MineIpad(t *testing.T) {
  32. Convey("Test_Mine", t, func() {
  33. mine, err := s.MineIpad(context.Background(), 16840123, "ios", "", 0, 2)
  34. So(err, ShouldBeNil)
  35. for _, item := range mine.IpadSections {
  36. Printf("%+v\n", item.Title)
  37. }
  38. })
  39. }
  40. func Test_MyInfo(t *testing.T) {
  41. Convey("Test_MyInfo", t, func() {
  42. myinfo, err := s.Myinfo(context.Background(), 1684013)
  43. So(err, ShouldBeNil)
  44. Printf("%+v", myinfo)
  45. })
  46. }
  47. func Test_LoadSidebar(t *testing.T) {
  48. Convey("Test_LoadSidebar", t, func() {
  49. Println("starting...")
  50. sections := s.sections(context.Background(), nil, nil, 1, 1, true, 1)
  51. for _, section := range sections {
  52. Println("section标题:" + section.Title)
  53. for _, item := range section.Items {
  54. Println(item.Title)
  55. }
  56. }
  57. })
  58. }