resource_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package databus
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. func TestAdd(t *testing.T) {
  7. InitAegis(nil)
  8. defer CloseAegis()
  9. err := Add(&AddInfo{
  10. BusinessID: 1,
  11. NetID: 1,
  12. OID: "1008612",
  13. MID: 110,
  14. Content: "内容",
  15. Extra6: 6,
  16. Extra4s: "4s",
  17. MetaData: `{"cover": "bfs/1.japg", "title": "标题啊"}`,
  18. ExtraTime1: time.Now().Add(-24 * time.Hour),
  19. OCtime: time.Now().Add(-24 * time.Hour),
  20. Ptime: time.Now().Add(-24 * time.Hour),
  21. })
  22. if err != nil {
  23. t.Fail()
  24. }
  25. }
  26. func TestUpdate(t *testing.T) {
  27. InitAegis(nil)
  28. defer CloseAegis()
  29. err := Update(&UpdateInfo{
  30. BusinessID: 1,
  31. NetID: 1,
  32. OID: "1008612",
  33. Update: map[string]interface{}{
  34. "mid": 119,
  35. "content": "内容2",
  36. "extra6": 60,
  37. "ptime": "2018-01-1 15:01:02",
  38. "metadata": `{"cover": "bfs/1.japg", "title": "标题啊"}`,
  39. },
  40. })
  41. if err != nil {
  42. t.Fail()
  43. }
  44. }
  45. func TestCancel(t *testing.T) {
  46. InitAegis(nil)
  47. defer CloseAegis()
  48. err := Cancel(&CancelInfo{
  49. BusinessID: 1,
  50. Oids: []string{"1008612"},
  51. Reason: "理由",
  52. })
  53. if err != nil {
  54. t.Fail()
  55. }
  56. }