mc_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoCookieCache(t *testing.T) {
  8. convey.Convey("CookieCache", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. session = ""
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. res, err := d.CookieCache(c, session)
  15. ctx.Convey("Then res should be nil.", func(ctx convey.C) {
  16. ctx.So(res, convey.ShouldBeNil)
  17. })
  18. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoDelCookieCache(t *testing.T) {
  25. convey.Convey("DelCookieCache", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. session = ""
  29. )
  30. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  31. err := d.DelCookieCache(c, session)
  32. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. })
  35. })
  36. })
  37. }
  38. func TestDaoTokenCache(t *testing.T) {
  39. convey.Convey("TokenCache", t, func(ctx convey.C) {
  40. var (
  41. c = context.Background()
  42. session = ""
  43. )
  44. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  45. res, err := d.TokenCache(c, session)
  46. ctx.Convey("Then res should be nil.", func(ctx convey.C) {
  47. ctx.So(res, convey.ShouldBeNil)
  48. })
  49. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  50. ctx.So(err, convey.ShouldBeNil)
  51. })
  52. })
  53. })
  54. }
  55. func TestDaoDelTokenCache(t *testing.T) {
  56. convey.Convey("DelTokenCache", t, func(ctx convey.C) {
  57. var (
  58. c = context.Background()
  59. session = ""
  60. )
  61. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  62. err := d.DelTokenCache(c, session)
  63. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  64. ctx.So(err, convey.ShouldBeNil)
  65. })
  66. })
  67. })
  68. }