Feat: auth middleware for complex request

This commit is contained in:
HFO4
2019-12-24 11:42:23 +08:00
parent 90827b2441
commit f8c8604cda
7 changed files with 124 additions and 16 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/DATA-DOG/go-sqlmock"
model "github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/pkg/util"
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
@@ -83,4 +84,10 @@ func TestInit(t *testing.T) {
mock.ExpectQuery("SELECT(.+)").WillReturnRows(sqlmock.NewRows([]string{"id", "value"}).AddRow(1, "12312312312312"))
Init()
asserts.NoError(mock.ExpectationsWereMet())
// slave模式
conf.SystemConfig.Mode = "slave"
asserts.Panics(func() {
Init()
})
}