mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-07 08:22:36 +02:00
Update tests.
This commit is contained in:
parent
aac4874e72
commit
4f8349d4c1
|
@ -34,6 +34,9 @@ func TestAllowedIps(t *testing.T) {
|
|||
if a.Empty() {
|
||||
t.Fatal("should not be empty")
|
||||
}
|
||||
if expected := `[127.0.0.1/32, 192.168.0.1/32, 192.168.1.0/24]`; a.String() != expected {
|
||||
t.Errorf("expected %s, got %s", expected, a.String())
|
||||
}
|
||||
|
||||
allowed := []string{
|
||||
"127.0.0.1",
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/textproto"
|
||||
|
@ -1737,6 +1738,7 @@ func TestBackendServer_TurnCredentials(t *testing.T) {
|
|||
func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
||||
CatchLogForTest(t)
|
||||
config := goconf.NewConfigFile()
|
||||
config.AddOption("app", "trustedproxies", "1.2.3.4")
|
||||
config.AddOption("stats", "allowed_ips", "127.0.0.1, 192.168.0.1, 192.168.1.1/24")
|
||||
_, backend, _, _, _, _ := CreateBackendServerForTestFromConfig(t, config)
|
||||
|
||||
|
@ -1763,6 +1765,10 @@ func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
|||
t.Errorf("should allow %s", addr)
|
||||
}
|
||||
|
||||
if host, _, err := net.SplitHostPort(addr); err == nil {
|
||||
addr = host
|
||||
}
|
||||
|
||||
r2 := &http.Request{
|
||||
RemoteAddr: "1.2.3.4:12345",
|
||||
Header: http.Header{
|
||||
|
|
Loading…
Reference in a new issue