apply_test.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package service
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. "go-common/app/admin/ep/melloi/model"
  6. )
  7. var (
  8. apply = model.Apply{ID: 1, Path: "bilibili.test.ep.melloi", From: "hujianping",
  9. To: "hujianping", Status: 1, Active: 1, StartTime: "1541007000", EndTime: "1541235600"}
  10. qar = model.QueryApplyRequest{
  11. Apply: apply,
  12. Pagination: model.Pagination{PageNum: 1, PageSize: 1, TotalSize: 1},
  13. }
  14. userName = "hujianping"
  15. cookie = "_AJSESSIONID=e2df43ed324d20811e8d1be1a9fb36d5"
  16. )
  17. func Test_Apply(t *testing.T) {
  18. Convey("query apply info", t, func() {
  19. _, err := s.QueryApply(&qar)
  20. So(err, ShouldBeNil)
  21. })
  22. Convey("query user applyList", t, func() {
  23. _, err := s.QueryUserApplyList(userName)
  24. So(err, ShouldBeNil)
  25. })
  26. Convey("add apply", t, func() {
  27. err := s.AddApply(c, cookie, &apply)
  28. So(err, ShouldBeNil)
  29. })
  30. Convey("update apply", t, func() {
  31. err := s.UpdateApply(cookie, &apply)
  32. So(err, ShouldBeNil)
  33. })
  34. Convey("delete apply", t, func() {
  35. err := s.DeleteApply(apply.ID)
  36. So(err, ShouldBeNil)
  37. })
  38. }