guest_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // TestAddGuest
  9. func TestDao_AddGuest(t *testing.T) {
  10. Convey("AddGuest", t, func() {
  11. once.Do(startService)
  12. res, err := d.AddGuest(context.TODO(), &item.GuestInfoRequest{
  13. Name: "gotester",
  14. GuestImg: "testerimg.jpg",
  15. Description: "this is a description",
  16. })
  17. So(res, ShouldBeTrue)
  18. So(err, ShouldBeNil)
  19. })
  20. }
  21. // TestUpdateGuest
  22. func TestDao_UpdateGuest(t *testing.T) {
  23. Convey("UpdateGuest", t, func() {
  24. once.Do(startService)
  25. res, err := d.UpdateGuest(context.TODO(), &item.GuestInfoRequest{
  26. ID: 55,
  27. Name: "gotester22",
  28. GuestImg: "testerimg.jpg2222",
  29. Description: "this is a description222",
  30. })
  31. So(res, ShouldBeTrue)
  32. So(err, ShouldBeNil)
  33. })
  34. }
  35. // TestGuestStatus
  36. func TestDao_GuestStatus(t *testing.T) {
  37. Convey("GuestStatus", t, func() {
  38. once.Do(startService)
  39. res, err := d.GuestStatus(context.TODO(), 57, 1)
  40. So(res, ShouldBeTrue)
  41. So(err, ShouldBeNil)
  42. })
  43. }
  44. // TestGetGuests
  45. func TestDao_GetGuests(t *testing.T) {
  46. Convey("GetGuest", t, func() {
  47. once.Do(startService)
  48. res, err := d.GetGuests(context.TODO(), 60)
  49. So(res, ShouldNotBeNil)
  50. So(err, ShouldBeNil)
  51. })
  52. }