Commit c59fd1c7 authored by MathiasB's avatar MathiasB

Defined test function in TestBuildEnv

parent ac197f16
......@@ -32,7 +32,9 @@ func TestRuleParseAddress(t *testing.T) {
}
func BuildEnvSingle(r *http.Request, rule Rule, fpath string, envExpected map[string]string, t *testing.T) {
func TestBuildEnv(t *testing.T) {
buildEnvSingle := func(r *http.Request, rule Rule, fpath string, envExpected map[string]string, t *testing.T) {
h := Handler{}
......@@ -47,9 +49,7 @@ func BuildEnvSingle(r *http.Request, rule Rule, fpath string, envExpected map[st
}
}
}
func TestBuildEnv(t *testing.T) {
}
rule := Rule{}
url, err := url.Parse("http://localhost:2015/fgci_test.php?test=blabla")
......@@ -80,16 +80,16 @@ func TestBuildEnv(t *testing.T) {
}
// 1. Test for full canonical IPv6 address
BuildEnvSingle(&r, rule, fpath, envExpected, t)
buildEnvSingle(&r, rule, fpath, envExpected, t)
// 2. Test for shorthand notation of IPv6 address
r.RemoteAddr = "[::1]:51688"
envExpected["REMOTE_ADDR"] = "[::1]"
BuildEnvSingle(&r, rule, fpath, envExpected, t)
buildEnvSingle(&r, rule, fpath, envExpected, t)
// 3. Test for IPv4 address
r.RemoteAddr = "192.168.0.10:51688"
envExpected["REMOTE_ADDR"] = "192.168.0.10"
BuildEnvSingle(&r, rule, fpath, envExpected, t)
buildEnvSingle(&r, rule, fpath, envExpected, t)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment