fix
This commit is contained in:
@@ -85,10 +85,10 @@ func GetSesssion() *requests.Session {
|
||||
|
||||
func GetSessionWithUserToken(t *testing.T, server requests.ITestServer, Host string, Port int) *requests.Session {
|
||||
ses := requests.NewSession()
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/user/login", Host, Port))
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/api/auth/login", Host, Port))
|
||||
tp.SetBodyJson(map[string]interface{}{
|
||||
"name": "9107058@qq.com",
|
||||
"pwd": "$2y$13$2y4O4OIz/zcK5C0vlSc9LuSpjWySjInLBSe49yDkE.iURb.R1hDsy",
|
||||
"email": "9107058@qq.com",
|
||||
"password": "t1I0hOs0/AmhZfNk9ZiNnd3YZJpI+LL6COnHAmYEJk4=",
|
||||
})
|
||||
resp, err := tp.TestExecute(server)
|
||||
if err != nil {
|
||||
@@ -104,17 +104,17 @@ func GetSessionWithUserToken(t *testing.T, server requests.ITestServer, Host str
|
||||
if !token.Exists() {
|
||||
t.Error("data.token is not exists")
|
||||
}
|
||||
ses.Header.Add("Authorization", token.String())
|
||||
ses.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token.String()))
|
||||
|
||||
return ses
|
||||
}
|
||||
|
||||
func GetBackendSessionWithUserToken(t *testing.T, server requests.ITestServer, Host string, Port int) *requests.Session {
|
||||
ses := requests.NewSession()
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/backend-user/login", Host, Port))
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/api/backend-user/login", Host, Port))
|
||||
tp.SetBodyJson(map[string]interface{}{
|
||||
"name": "admin@admin.com",
|
||||
"pwd": "ZnVzZW5fYmFja2VuZF8yMDIz47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU=",
|
||||
"email": "admin@admin.com",
|
||||
"pwd": "ZnVzZW5fYmFja2VuZF8yMDIz47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU=",
|
||||
})
|
||||
resp, err := tp.TestExecute(server)
|
||||
if err != nil {
|
||||
@@ -130,14 +130,14 @@ func GetBackendSessionWithUserToken(t *testing.T, server requests.ITestServer, H
|
||||
if !token.Exists() {
|
||||
t.Error("data.token is not exists")
|
||||
}
|
||||
ses.Header.Add("Authorization", token.String())
|
||||
ses.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token.String()))
|
||||
|
||||
return ses
|
||||
}
|
||||
|
||||
func GetSesssionWithGuestToken(t *testing.T, server requests.ITestServer, Host string, Port int) *requests.Session {
|
||||
ses := requests.NewSession()
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/accept/cookie", Host, Port))
|
||||
tp := ses.Post(fmt.Sprintf("http://%s:%d/api/auth/accept/cookie", Host, Port))
|
||||
|
||||
resp, err := tp.TestExecute(server)
|
||||
if err != nil {
|
||||
@@ -148,7 +148,7 @@ func GetSesssionWithGuestToken(t *testing.T, server requests.ITestServer, Host s
|
||||
if !token.Exists() {
|
||||
t.Error("data.token is not exists")
|
||||
}
|
||||
ses.Header.Add("Authorization", token.String())
|
||||
ses.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token.String()))
|
||||
|
||||
return ses
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user