17 Star 44 Fork 12

hanguofeng / gocaptcha

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mcstore_test.go 749 Bytes
一键复制 编辑 原始数据 按行查看 历史
hanguofeng 提交于 2014-01-22 00:02 . add log for test
// 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 TestMCStore(t *testing.T) {
memcacheServers := []string{"127.0.0.1:11211"}
store := CreateMCStore(100*time.Second, memcacheServers) //100 s
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 mc:%s", retV)
//test del
store.Del(key)
retV = store.Get(key)
if nil != retV {
t.Errorf("not del")
}
}
1
https://gitee.com/hanguofeng/gocaptcha.git
git@gitee.com:hanguofeng/gocaptcha.git
hanguofeng
gocaptcha
gocaptcha
master

搜索帮助