fix installer
This commit is contained in:
parent
46030a5b14
commit
c2091e746a
19 changed files with 264 additions and 73 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue