1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-27 09:50:49 +00:00
Beego/pkg/plugins/apiauth/apiauth_test.go

21 lines
425 B
Go
Raw Normal View History

2020-07-22 14:50:08 +00:00
package apiauth
import (
"net/url"
"testing"
)
func TestSignature(t *testing.T) {
appsecret := "beego secret"
method := "GET"
RequestURL := "http://localhost/test/url"
params := make(url.Values)
params.Add("arg1", "hello")
params.Add("arg2", "beego")
signature := "mFdpvLh48ca4mDVEItE9++AKKQ/IVca7O/ZyyB8hR58="
if Signature(appsecret, method, params, RequestURL) != signature {
t.Error("Signature error")
}
}