1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/hanguofeng-gocaptcha

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
redisstore_test.go 848
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
hanguofeng Отправлено 24.05.2015 18:01 83c0a02
// Copyright 2013 hanguofeng. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package gocaptcha
import (
"testing"
"time"
)
func TestRedisStore(t *testing.T) {
storeConfig:=&StoreConfig{}
storeConfig.CaptchaConfig.LifeTime=time.Second*100
storeConfig.Engine="redis"
storeConfig.Servers= []string{"127.0.0.1:6379"}
store ,_:= CreateCaptchaRedisStore(storeConfig)
captcha := new(CaptchaInfo)
captcha.Text = "hello"
captcha.CreateTime = time.Now()
//test add and get
key := store.Add(captcha)
retV := store.Get(key)
if retV.Text != captcha.Text {
t.Errorf("not equal,retV:%s,captcha:%s", retV, captcha)
}
t.Logf("TestMCStore:get from redis:%s", retV)
//test del
store.Del(key)
retV = store.Get(key)
if nil != retV {
t.Errorf("not del")
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/hanguofeng-gocaptcha.git
git@api.gitlife.ru:oschina-mirror/hanguofeng-gocaptcha.git
oschina-mirror
hanguofeng-gocaptcha
hanguofeng-gocaptcha
master