github.com/astaxie/beego@v1.12.3/plugins/apiauth/apiauth_test.go (about) 1 package apiauth 2 3 import ( 4 "net/url" 5 "testing" 6 ) 7 8 func TestSignature(t *testing.T) { 9 appsecret := "beego secret" 10 method := "GET" 11 RequestURL := "http://localhost/test/url" 12 params := make(url.Values) 13 params.Add("arg1", "hello") 14 params.Add("arg2", "beego") 15 16 signature := "mFdpvLh48ca4mDVEItE9++AKKQ/IVca7O/ZyyB8hR58=" 17 if Signature(appsecret, method, params, RequestURL) != signature { 18 t.Error("Signature error") 19 } 20 }