Browse Source

Cache session cookies in tests (#2128)

tags/v1.2.0-rc1
Ethan Koenig Lunny Xiao 8 years ago
parent
commit
fa89bacb86
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      integrations/integration_test.go

+ 8
- 1
integrations/integration_test.go View File

@@ -158,8 +158,15 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu


const userPassword = "password" const userPassword = "password"


var loginSessionCache = make(map[string]*TestSession, 10)

func loginUser(t testing.TB, userName string) *TestSession { func loginUser(t testing.TB, userName string) *TestSession {
return loginUserWithPassword(t, userName, userPassword)
if session, ok := loginSessionCache[userName]; ok {
return session
}
session := loginUserWithPassword(t, userName, userPassword)
loginSessionCache[userName] = session
return session
} }


func loginUserWithPassword(t testing.TB, userName, password string) *TestSession { func loginUserWithPassword(t testing.TB, userName, password string) *TestSession {


Loading…
Cancel
Save