Skip to content

Commit 60b4259

Browse files
committed
chore: use different urls
1 parent 9338b41 commit 60b4259

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/integration/attachment_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ func createAttachment(t *testing.T, session *TestSession, repoURL, filename stri
4141
err = writer.Close()
4242
assert.NoError(t, err)
4343

44-
csrf := GetCSRF(t, session, "/user/login")
44+
var csrf string
45+
// FIXME: It's quite hacky to determine if it's a logged in user or not and use the right URL to get the CSRF token
46+
if expectedStatus == http.StatusSeeOther {
47+
// the session is not logged in
48+
csrf = GetCSRF(t, session, "/user/login")
49+
} else {
50+
// the session is logged in
51+
csrf = GetCSRF(t, session, repoURL)
52+
}
4553

4654
req := NewRequestWithBody(t, "POST", repoURL+"/issues/attachments", body)
4755
req.Header.Add("X-Csrf-Token", csrf)

0 commit comments

Comments
 (0)