fix installer

This commit is contained in:
Daniel Noulet 2026-10-02 21:45:42 +02:00
parent 46030a5b14
commit c2091e746a
19 changed files with 264 additions and 73 deletions

View file

@ -1,8 +1,12 @@
package server
import (
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/danyel/go-loose/internal/config"
)
func TestLoginGuardLocksAfterFiveFailures(t *testing.T) {
@ -22,3 +26,19 @@ func TestLoginGuardLocksAfterFiveFailures(t *testing.T) {
t.Fatal("successful login did not clear failures")
}
}
func TestPasswordLoginIsRejectedOnSystemHost(t *testing.T) {
server := &Server{
cfg: config.Config{AuthDomain: "auth.dev", LocalLogin: true},
loginGuard: newLoginGuard(),
}
server.installed.Store(true)
request := httptest.NewRequest(http.MethodPost, "http://auth.dev/auth/password", nil)
response := httptest.NewRecorder()
server.passwordLogin(response, request)
if response.Code != http.StatusNotFound {
t.Fatalf("status = %d, want %d", response.Code, http.StatusNotFound)
}
}