mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Test: file compress / download
This commit is contained in:
@@ -2,6 +2,7 @@ package auth
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/util"
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var mock sqlmock.Sqlmock
|
||||
@@ -64,6 +66,16 @@ func TestHMACAuth_Check(t *testing.T) {
|
||||
sign := auth.Sign("content", 1)
|
||||
asserts.Error(auth.Check("content", sign+":"))
|
||||
}
|
||||
|
||||
// 过期日期格式错误
|
||||
{
|
||||
asserts.Error(auth.Check("content", "ErrAuthFailed:ErrAuthFailed"))
|
||||
}
|
||||
|
||||
// 签名有误
|
||||
{
|
||||
asserts.Error(auth.Check("content", fmt.Sprintf("sign:%d", time.Now().Unix()+10)))
|
||||
}
|
||||
}
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user