captcha_test.go 906 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestCaptcha(t *testing.T) {
  8. convey.Convey("Captcha", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. p1, p2, err := d.Captcha(c)
  14. ctx.Convey("Then err should be nil.p1,p2 should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(p2, convey.ShouldNotBeNil)
  17. ctx.So(p1, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestVerify(t *testing.T) {
  23. convey.Convey("Verify", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. token = ""
  27. code = ""
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. err := d.Verify(c, token, code, "")
  31. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }