mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-17 14:39:58 +02:00
refactor: fix tests
This commit is contained in:
@@ -52,6 +52,7 @@ func NewServer(name string, url *net.URL, weight Weight, handler http.Handler, h
|
||||
func TestNewServer[T ~int | ~float32 | ~float64](weight T) Server {
|
||||
srv := &server{
|
||||
weight: Weight(weight),
|
||||
url: net.MustParseURL("http://localhost"),
|
||||
}
|
||||
return srv
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/common"
|
||||
"github.com/yusing/go-proxy/internal/net/types"
|
||||
. "github.com/yusing/go-proxy/internal/utils/testing"
|
||||
)
|
||||
@@ -15,7 +14,7 @@ func TestRedirectToHTTPs(t *testing.T) {
|
||||
})
|
||||
ExpectNoError(t, err)
|
||||
ExpectEqual(t, result.ResponseStatus, http.StatusPermanentRedirect)
|
||||
ExpectEqual(t, result.ResponseHeaders.Get("Location"), "https://example.com:"+common.ProxyHTTPSPort)
|
||||
ExpectEqual(t, result.ResponseHeaders.Get("Location"), "https://example.com")
|
||||
}
|
||||
|
||||
func TestNoRedirect(t *testing.T) {
|
||||
|
||||
@@ -8,19 +8,6 @@ theGreatPretender:
|
||||
- X-Test3
|
||||
- X-Test4
|
||||
|
||||
notAuthenticAuthentik:
|
||||
- use: RedirectHTTP
|
||||
- use: ForwardAuth
|
||||
address: https://authentik.company
|
||||
trustForwardHeader: true
|
||||
addAuthCookiesToResponse:
|
||||
- session_id
|
||||
- user_id
|
||||
authResponseHeaders:
|
||||
- X-Auth-SessionID
|
||||
- X-Auth-UserID
|
||||
- use: CustomErrorPage
|
||||
|
||||
realIPAuthentik:
|
||||
- use: RedirectHTTP
|
||||
- use: RealIP
|
||||
@@ -30,9 +17,6 @@ realIPAuthentik:
|
||||
- "192.168.0.0/16"
|
||||
- "172.16.0.0/12"
|
||||
recursive: true
|
||||
- use: ForwardAuth
|
||||
address: https://authentik.company
|
||||
trustForwardHeader: true
|
||||
|
||||
testFakeRealIP:
|
||||
- use: ModifyRequest
|
||||
|
||||
Reference in New Issue
Block a user