bulletin_test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. item "go-common/app/service/openplatform/ticket-item/api/grpc/v1"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. // TestGetBulletins
  9. func TestDao_GetBulletins(t *testing.T) {
  10. Convey("GetBulletins", t, func() {
  11. once.Do(startService)
  12. res, err := d.GetBulletins(context.TODO(), 72)
  13. So(res, ShouldNotBeNil)
  14. So(err, ShouldBeNil)
  15. })
  16. }
  17. // TestAddBulletin
  18. func TestDao_AddBulletin(t *testing.T) {
  19. Convey("AddBulletin", t, func() {
  20. once.Do(startService)
  21. res, err := d.AddBulletin(context.TODO(), &item.BulletinInfoRequest{
  22. ParentID: 72,
  23. Title: "go test bulletin",
  24. Content: "goooo",
  25. Detail: "goo",
  26. TargetItem: 0,
  27. })
  28. So(res, ShouldBeTrue)
  29. So(err, ShouldBeNil)
  30. })
  31. }
  32. // TestUpdateBulletin
  33. func TestDao_UpdateBulletin(t *testing.T) {
  34. Convey("UpdateBulletin", t, func() {
  35. once.Do(startService)
  36. res, err := d.UpdateBulletin(context.TODO(), &item.BulletinInfoRequest{
  37. ParentID: 72,
  38. Title: "go test bulletin22",
  39. Content: "gooossso",
  40. Detail: "goo",
  41. TargetItem: 0,
  42. VerID: 2692936350844594047,
  43. })
  44. So(res, ShouldBeTrue)
  45. So(err, ShouldBeNil)
  46. })
  47. }
  48. // TestPassBulletin
  49. func TestDao_PassBulletin(t *testing.T) {
  50. Convey("PassBulletin", t, func() {
  51. once.Do(startService)
  52. res, err := d.PassBulletin(context.TODO(), 2692936350844594047)
  53. So(res, ShouldBeTrue)
  54. So(err, ShouldBeNil)
  55. })
  56. }
  57. // TestUnpublishBulletin
  58. func TestDao_UnpublishBulletin(t *testing.T) {
  59. Convey("UnpublishBulletin", t, func() {
  60. once.Do(startService)
  61. res, err := d.UnpublishBulletin(context.TODO(), 2692936350844594047, -1)
  62. So(res, ShouldBeTrue)
  63. So(err, ShouldBeNil)
  64. })
  65. }