Cloudreve/middleware/session_test.go

31 lines
494 B
Go
Raw Normal View History

2019-11-12 15:34:54 +08:00
package middleware
import (
2019-12-04 13:49:28 +08:00
"github.com/HFO4/cloudreve/pkg/conf"
2019-11-12 15:34:54 +08:00
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"testing"
)
func TestSession(t *testing.T) {
asserts := assert.New(t)
2019-12-04 13:49:28 +08:00
{
handler := Session("2333")
asserts.NotNil(handler)
asserts.NotNil(Store)
asserts.IsType(emptyFunc(), handler)
}
{
conf.RedisConfig.Server = "123"
asserts.Panics(func() {
Session("2333")
})
}
2019-11-12 15:34:54 +08:00
}
func emptyFunc() gin.HandlerFunc {
return func(c *gin.Context) {}
}