1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/gin-contrib/sessions/mongo_test.go

40 lines
741 B
Go
Raw Normal View History

2017-10-03 21:43:55 +03:00
package sessions
import (
"testing"
mgo "gopkg.in/mgo.v2"
)
const mongoTestServer = "localhost:27017"
var newMongoStore = func(_ *testing.T) Store {
session, err := mgo.Dial(mongoTestServer)
if err != nil {
panic(err)
}
c := session.DB("test").C("sessions")
return NewMongoStore(c, 3600, true, []byte("secret"))
}
func TestMongo_SessionGetSet(t *testing.T) {
sessionGetSet(t, newMongoStore)
}
func TestMongo_SessionDeleteKey(t *testing.T) {
sessionDeleteKey(t, newMongoStore)
}
func TestMongo_SessionFlashes(t *testing.T) {
sessionFlashes(t, newMongoStore)
}
func TestMongo_SessionClear(t *testing.T) {
sessionClear(t, newMongoStore)
}
func TestMongo_SessionOptions(t *testing.T) {
sessionOptions(t, newMongoStore)
}