Skip to content

Commit 5abd1d2

Browse files
ethantkoenigappleboy
authored andcommitted
Add integration test for logging out (#2892)
1 parent 1ebf257 commit 5abd1d2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

integrations/signout_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2017 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package integrations
6+
7+
import (
8+
"net/http"
9+
"testing"
10+
)
11+
12+
func TestSignOut(t *testing.T) {
13+
prepareTestEnv(t)
14+
15+
session := loginUser(t, "user2")
16+
17+
req := NewRequest(t, "GET", "/user/logout")
18+
session.MakeRequest(t, req, http.StatusFound)
19+
20+
// try to view a private repo, should fail
21+
req = NewRequest(t, "GET", "/user2/repo2/")
22+
session.MakeRequest(t, req, http.StatusNotFound)
23+
24+
// invalidate cached cookies for user2, for subsequent tests
25+
delete(loginSessionCache, "user2")
26+
}

0 commit comments

Comments
 (0)