mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-28 11:14:54 -04:00
chore: update ingration test
No session ID is even send now
This commit is contained in:
parent
ea9f2a236b
commit
dfbd6e5069
1 changed files with 5 additions and 17 deletions
|
|
@ -6,7 +6,6 @@ package integration
|
|||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
|
@ -31,8 +30,9 @@ func getSessionID(t *testing.T, resp *httptest.ResponseRecorder) string {
|
|||
found = true
|
||||
}
|
||||
}
|
||||
assert.True(t, found)
|
||||
assert.NotEmpty(t, sessionID)
|
||||
if found {
|
||||
assert.NotEmpty(t, sessionID)
|
||||
}
|
||||
return sessionID
|
||||
}
|
||||
|
||||
|
|
@ -40,18 +40,6 @@ func sessionFile(tmpDir, sessionID string) string {
|
|||
return filepath.Join(tmpDir, sessionID[0:1], sessionID[1:2], sessionID)
|
||||
}
|
||||
|
||||
func sessionFileExist(t *testing.T, tmpDir, sessionID string) bool {
|
||||
sessionFile := sessionFile(tmpDir, sessionID)
|
||||
_, err := os.Lstat(sessionFile)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
require.NoError(t, err)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func TestSessionFileCreation(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
defer test.MockProtect(&setting.SessionConfig.ProviderConfig)()
|
||||
|
|
@ -82,7 +70,7 @@ func TestSessionFileCreation(t *testing.T) {
|
|||
sessionID := getSessionID(t, resp)
|
||||
|
||||
// We're not logged in so there should be no session
|
||||
assert.False(t, sessionFileExist(t, tmpDir, sessionID))
|
||||
assert.Empty(t, sessionID)
|
||||
})
|
||||
t.Run("CreateSessionOnLogin", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
|
@ -92,7 +80,7 @@ func TestSessionFileCreation(t *testing.T) {
|
|||
sessionID := getSessionID(t, resp)
|
||||
|
||||
// We're not logged in so there should be no session
|
||||
assert.False(t, sessionFileExist(t, tmpDir, sessionID))
|
||||
assert.Empty(t, sessionID)
|
||||
|
||||
req = NewRequestWithValues(t, "POST", "/user/login", map[string]string{
|
||||
"user_name": "user2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue