aboutsummaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-07-08 22:07:29 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-07-09 10:07:29 +0800
commit89cd4dd424f844c2c1a8f0d0ee37033e36d83db4 (patch)
tree1344b1b291c9933196703f39ce6c99b02744dc38 /integrations
parent4c57db79247584dce0e4e26b5cdd2d8aaea336e3 (diff)
downloadgitea-89cd4dd424f844c2c1a8f0d0ee37033e36d83db4.tar.gz
gitea-89cd4dd424f844c2c1a8f0d0ee37033e36d83db4.zip
Cache session cookies in tests (#2128)
Diffstat (limited to 'integrations')
-rw-r--r--integrations/integration_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go
index 478eb976c8..83c73ec662 100644
--- a/integrations/integration_test.go
+++ b/integrations/integration_test.go
@@ -158,8 +158,15 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu
const userPassword = "password"
+var loginSessionCache = make(map[string]*TestSession, 10)
+
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 {