setting_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_SettingInfo(t *testing.T) {
  9. Convey("test setting info", t, WithService(func(s *Service) {
  10. mid := int64(88889018)
  11. data, err := s.SettingInfo(context.Background(), mid)
  12. So(err, ShouldBeNil)
  13. var str []byte
  14. str, err = json.Marshal(data)
  15. So(err, ShouldBeNil)
  16. Printf("%+v", string(str))
  17. }))
  18. }
  19. func TestService_IndexOrderModify(t *testing.T) {
  20. Convey("test index order modify", t, WithService(func(s *Service) {
  21. mid := int64(88889018)
  22. orderNum := []string{"1", "8", "7", "2", "3", "4", "5", "6", "9", "21", "22", "23", "24", "25"}
  23. err := s.IndexOrderModify(context.Background(), mid, orderNum)
  24. So(err, ShouldBeNil)
  25. }))
  26. }
  27. func TestService_PrivacyModify(t *testing.T) {
  28. Convey("test index order modify", t, WithService(func(s *Service) {
  29. mid := int64(88889018)
  30. field := "bangumi"
  31. value := 0
  32. err := s.PrivacyModify(context.Background(), mid, field, value)
  33. So(err, ShouldBeNil)
  34. }))
  35. }
  36. func TestService_fixIndexOrder(t *testing.T) {
  37. Convey("test fixIndexOrder", t, WithService(func(s *Service) {
  38. mid := int64(88889018)
  39. indexOrder := `["1","3","2","5","6","4",7,21,22,23,24,25]`
  40. s.fixIndexOrder(context.Background(), mid, indexOrder)
  41. }))
  42. }