rpc_test.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package archive
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestArchiveUpCount(t *testing.T) {
  8. convey.Convey("UpCount", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. mid = int64(1)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. _, err := d.UpCount(c, mid)
  15. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldEqual, err)
  17. })
  18. })
  19. })
  20. }
  21. func TestArchiveArchives(t *testing.T) {
  22. convey.Convey("Archives", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. aids = []int64{}
  26. )
  27. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  28. _, err := d.Archives(c, aids)
  29. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldEqual, err)
  31. })
  32. })
  33. })
  34. }
  35. func TestArchiveArchive(t *testing.T) {
  36. convey.Convey("Archive", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. aid = int64(0)
  40. )
  41. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  42. _, err := d.Archive(c, aid)
  43. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldEqual, err)
  45. })
  46. })
  47. })
  48. }
  49. func TestArchiveStats(t *testing.T) {
  50. convey.Convey("Stats", t, func(ctx convey.C) {
  51. var (
  52. c = context.Background()
  53. aids = []int64{}
  54. )
  55. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  56. _, err := d.Stats(c, aids)
  57. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldEqual, err)
  59. })
  60. })
  61. })
  62. }
  63. func TestArchiveArticleMetas(t *testing.T) {
  64. convey.Convey("ArticleMetas", t, func(ctx convey.C) {
  65. var (
  66. c = context.Background()
  67. aids = []int64{}
  68. )
  69. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  70. _, err := d.ArticleMetas(c, aids)
  71. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  72. ctx.So(err, convey.ShouldEqual, err)
  73. })
  74. })
  75. })
  76. }