subject_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/dm/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestArchiveList(t *testing.T) {
  9. req := &model.ArchiveListReq{
  10. ID: 34261,
  11. IDType: "oid",
  12. Sort: "desc",
  13. Order: "mtime",
  14. Pn: 1,
  15. Ps: 50,
  16. Page: int64(model.CondIntNil),
  17. State: int64(model.CondIntNil),
  18. }
  19. convey.Convey("test last archive list", t, func() {
  20. res, err := svr.ArchiveList(context.TODO(), req)
  21. convey.So(err, convey.ShouldBeNil)
  22. convey.So(res, convey.ShouldNotBeEmpty)
  23. t.Logf("===%+v", res.Page)
  24. for _, v := range res.ArcLists {
  25. t.Logf("===%+v", v)
  26. }
  27. })
  28. }
  29. func TestServiceUptSubjectsState(t *testing.T) {
  30. convey.Convey("UptSubjectsState", t, func() {
  31. err := svr.UptSubjectsState(context.TODO(), 1, 111, "test", []int64{1221}, 1, "aaaaa")
  32. convey.So(err, convey.ShouldBeNil)
  33. })
  34. }
  35. func TestServiceUpSubjectMaxLimit(t *testing.T) {
  36. convey.Convey("UpSubjectMaxLimit", t, func() {
  37. err := svr.UpSubjectMaxLimit(context.TODO(), 1, 10131812, 333)
  38. convey.So(err, convey.ShouldBeNil)
  39. })
  40. }
  41. func TestServiceSubjectLog(t *testing.T) {
  42. convey.Convey("SubjectLog", t, func() {
  43. data, err := svr.SubjectLog(context.TODO(), 1, 1221)
  44. convey.So(err, convey.ShouldBeNil)
  45. convey.So(data, convey.ShouldNotBeNil)
  46. for _, v := range data {
  47. t.Logf("====%+v", v)
  48. }
  49. })
  50. }