captcha_mc_test.go 735 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. var (
  8. token = "5049a45ffc7c49489c14a7677c4548e2"
  9. ttl = 150
  10. )
  11. func TestAddTokenCache(t *testing.T) {
  12. var (
  13. c = context.TODO()
  14. )
  15. Convey("err should return nil, and ttl not -1", t, func() {
  16. err := d.AddTokenCache(c, token, int32(ttl))
  17. So(err, ShouldBeNil)
  18. })
  19. }
  20. func TestDelCaptchaCache(t *testing.T) {
  21. var (
  22. c = context.TODO()
  23. )
  24. Convey("err should return nil", t, func() {
  25. err := d.DelCaptchaCache(c, token)
  26. So(err, ShouldBeNil)
  27. })
  28. }
  29. func TestCaptchaCache(t *testing.T) {
  30. var (
  31. c = context.TODO()
  32. )
  33. Convey("err should return nil", t, func() {
  34. _, _, err := d.CaptchaCache(c, token)
  35. So(err, ShouldBeNil)
  36. })
  37. }