region_test.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/tv/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_RegList(t *testing.T) {
  9. Convey("region list", t, WithService(func(s *Service) {
  10. var (
  11. err error
  12. param = &model.Param{}
  13. res []*model.RegList
  14. c = context.Background()
  15. )
  16. res, err = s.RegList(c, param)
  17. So(err, ShouldBeNil)
  18. So(len(res), ShouldBeGreaterThan, 0)
  19. }))
  20. }
  21. func TestService_AddReg(t *testing.T) {
  22. Convey("add region", t, WithService(func(s *Service) {
  23. var (
  24. err error
  25. c = context.Background()
  26. )
  27. err = s.AddReg(c, "0", "0", "0", "1")
  28. So(err, ShouldBeNil)
  29. }))
  30. }
  31. func TestService_EditReg(t *testing.T) {
  32. Convey("edit region", t, WithService(func(s *Service) {
  33. var (
  34. err error
  35. c = context.Background()
  36. )
  37. err = s.EditReg(c, "0", "0", "0", "0")
  38. So(err, ShouldBeNil)
  39. }))
  40. }
  41. func TestService_UpState(t *testing.T) {
  42. Convey("update state", t, WithService(func(s *Service) {
  43. var (
  44. err error
  45. c = context.Background()
  46. pids = []int{1}
  47. state = "0"
  48. )
  49. err = s.UpState(c, pids, state)
  50. So(err, ShouldBeNil)
  51. }))
  52. }
  53. func TestService_RegSort(t *testing.T) {
  54. Convey("update region sort", t, WithService(func(s *Service) {
  55. var (
  56. err error
  57. c = context.Background()
  58. ids = []int{1}
  59. )
  60. err = s.RegSort(c, ids)
  61. So(err, ShouldBeNil)
  62. }))
  63. }