push_test.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/service/main/push/dao/oppo"
  6. "go-common/app/service/main/push/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func Test_roundIndex(t *testing.T) {
  10. Convey("ping redis", t, WithDao(func(d *Dao) {
  11. err := d.pingRedis(context.Background())
  12. PromChanLen("a", 1)
  13. So(err, ShouldBeNil)
  14. _, err = d.roundIndex(0, 0)
  15. So(err, ShouldNotBeNil)
  16. logPushError("asd", 1, []string{"asd"})
  17. }))
  18. }
  19. func TestPushIPhone(t *testing.T) {
  20. Convey("push ipad", t, WithDao(func(d *Dao) {
  21. _, err := d.PushIPhone(context.Background(), &model.PushInfo{}, &model.PushItem{})
  22. So(err, ShouldNotBeNil)
  23. }))
  24. }
  25. func TestPushIPad(t *testing.T) {
  26. Convey("push ipad", t, WithDao(func(d *Dao) {
  27. _, err := d.PushIPad(context.Background(), &model.PushInfo{}, &model.PushItem{})
  28. So(err, ShouldNotBeNil)
  29. }))
  30. }
  31. func TestPushMi(t *testing.T) {
  32. Convey("push mi", t, WithDao(func(d *Dao) {
  33. _, err := d.PushMi(context.Background(), &model.PushInfo{}, "", "123")
  34. So(err, ShouldNotBeNil)
  35. }))
  36. }
  37. func TestPushMiByMids(t *testing.T) {
  38. Convey("push mi by mids", t, WithDao(func(d *Dao) {
  39. _, err := d.PushMiByMids(context.Background(), &model.PushInfo{}, "", "123")
  40. So(err, ShouldBeNil)
  41. }))
  42. }
  43. func TestPushHuawei(t *testing.T) {
  44. Convey("push huawei", t, WithDao(func(d *Dao) {
  45. _, err := d.PushHuawei(context.Background(), &model.PushInfo{}, "", []string{"123"})
  46. So(err, ShouldNotBeNil)
  47. }))
  48. }
  49. func TestPushOppo(t *testing.T) {
  50. Convey("push oppo", t, WithDao(func(d *Dao) {
  51. _, err := d.PushOppo(context.Background(), &model.PushInfo{}, "", []string{"123"})
  52. So(err, ShouldNotBeNil)
  53. }))
  54. }
  55. func TestPushOppoOne(t *testing.T) {
  56. Convey("push oppo one", t, WithDao(func(d *Dao) {
  57. _, err := d.PushOppoOne(context.Background(), &model.PushInfo{}, &oppo.Message{}, "123")
  58. So(err, ShouldNotBeNil)
  59. }))
  60. }
  61. func TestPushJpush(t *testing.T) {
  62. Convey("push jpush", t, WithDao(func(d *Dao) {
  63. _, err := d.PushJpush(context.Background(), &model.PushInfo{}, "", []string{"123"})
  64. So(err, ShouldNotBeNil)
  65. }))
  66. }
  67. func TestPushFCM(t *testing.T) {
  68. Convey("push fcm", t, WithDao(func(d *Dao) {
  69. _, err := d.PushFCM(context.Background(), &model.PushInfo{}, "", []string{"123"})
  70. So(err, ShouldNotBeNil)
  71. }))
  72. }