30 lines
558 B
Go
30 lines
558 B
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"game/common/testHelper"
|
||
|
"game/common/utils"
|
||
|
"github.com/fox/fox/db"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
userId = 1111
|
||
|
gateId = "gate-1"
|
||
|
token = "token"
|
||
|
)
|
||
|
|
||
|
func TestUserGate(t *testing.T) {
|
||
|
UserRedis, err = db.InitRedis(testHelper.RedisPassword, testHelper.Host, testHelper.RedisPort, 0)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
var ug *UserGate
|
||
|
ug, err = NewUserGate().Get(userId, gateId)
|
||
|
if err != nil {
|
||
|
t.Log(err)
|
||
|
ug.Set(userId, gateId, token)
|
||
|
ug, _ = NewUserGate().Get(userId, gateId)
|
||
|
}
|
||
|
t.Logf("user_gate:%v", utils.Marshal(ug))
|
||
|
}
|