You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudreve/middleware/session_test.go

31 lines
494 B

5 years ago
package middleware
import (
"github.com/HFO4/cloudreve/pkg/conf"
5 years ago
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"testing"
)
func TestSession(t *testing.T) {
asserts := assert.New(t)
{
handler := Session("2333")
asserts.NotNil(handler)
asserts.NotNil(Store)
asserts.IsType(emptyFunc(), handler)
}
{
conf.RedisConfig.Server = "123"
asserts.Panics(func() {
Session("2333")
})
}
5 years ago
}
func emptyFunc() gin.HandlerFunc {
return func(c *gin.Context) {}
}