academy_test.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoArchive(t *testing.T) {
  8. convey.Convey("Archive", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. aid = int64(10110788)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. a, err := d.Archive(c, aid)
  15. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(a, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaoArchives(t *testing.T) {
  23. convey.Convey("Archives", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. aids = []int64{10110788}
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. a, err := d.Archives(c, aids)
  30. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(a, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestDaoArticleMetas(t *testing.T) {
  38. convey.Convey("ArticleMetas", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. aids = []int64{10110788}
  42. )
  43. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  44. res, err := d.ArticleMetas(c, aids)
  45. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. ctx.So(res, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }
  52. func TestDaoStats(t *testing.T) {
  53. convey.Convey("Stats", t, func(ctx convey.C) {
  54. var (
  55. c = context.Background()
  56. aids = []int64{10110788}
  57. ip = ""
  58. )
  59. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  60. a, err := d.Stats(c, aids, ip)
  61. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  62. ctx.So(err, convey.ShouldBeNil)
  63. ctx.So(a, convey.ShouldNotBeNil)
  64. })
  65. })
  66. })
  67. }