From 2732a476fd63d592a985325c94d883b105d9ef83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 17 Feb 2024 15:47:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/captcha/captcha_test.go | 42 ------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 pkg/captcha/captcha_test.go diff --git a/pkg/captcha/captcha_test.go b/pkg/captcha/captcha_test.go deleted file mode 100644 index f88b0c5d..00000000 --- a/pkg/captcha/captcha_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package captcha - -import ( - "testing" - "time" - - testifymock "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/suite" - - "github.com/goravel/framework/testing/mock" -) - -type CaptchaTestSuite struct { - suite.Suite - captcha *Captcha -} - -func TestCaptchaTestSuite(t *testing.T) { - mockConfig := mock.Config() - mockConfig.On("GetString", "app.name").Return("HaoZiPanel").Once() - mockConfig.On("GetInt", "captcha.height").Return(80).Once() - mockConfig.On("GetInt", "captcha.width").Return(240).Once() - mockConfig.On("GetInt", "captcha.length").Return(4).Once() - mockConfig.On("Get", "captcha.maxskew").Return(0.7).Once() - mockConfig.On("GetInt", "captcha.dotcount").Return(80).Once() - mockConfig.On("GetInt", "captcha.expire_time").Return(5).Once() - mockConfig.On("GetInt", "captcha.debug_expire_time").Return(10).Once() - mockConfig.On("GetBool", "app.debug").Return(true).Once() - mockCache, _, _ := mock.Cache() - mockCache.On("Put", testifymock.Anything, testifymock.Anything, time.Minute*time.Duration(10)).Return(nil).Once() - suite.Run(t, &CaptchaTestSuite{ - captcha: NewCaptcha(), - }) - mockConfig.AssertExpectations(t) -} - -func (s *CaptchaTestSuite) TestGenerateCaptcha() { - id, base64, err := s.captcha.GenerateCaptcha() - s.NotEmpty(id) - s.NotEmpty(base64) - s.Nil(err) -}