sync_test.go 809 B

1234567891011121314151617181920212223242526272829
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/vip/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoSyncAddUser(t *testing.T) {
  9. var r = &model.VipUserInfo{Mid: 7993}
  10. convey.Convey("clean data before", t, func() {
  11. d.db.Exec(context.Background(), "delete from vip_user_info where mid = ?", r.Mid)
  12. })
  13. convey.Convey("SyncAddUser", t, func() {
  14. err := d.SyncAddUser(context.Background(), r)
  15. convey.So(err, convey.ShouldBeNil)
  16. })
  17. convey.Convey("SyncUpdateUser", t, func() {
  18. r.Status = 2
  19. eff, err := d.SyncUpdateUser(context.Background(), r, r.Ver)
  20. convey.So(err, convey.ShouldBeNil)
  21. convey.So(eff, convey.ShouldNotBeNil)
  22. })
  23. convey.Convey("clean data", t, func() {
  24. d.db.Exec(context.Background(), "delete from vip_user_info where mid = ?", r.Mid)
  25. })
  26. }