mirror of
https://github.com/kataras/iris.git
synced 2026-01-01 01:07:06 +00:00
Add tests for RedirectTo, Sessions, Flash messages and for Cookies.
Former-commit-id: 5a631c366c4caf1d45c532dc5363459cb595f067
This commit is contained in:
33
addr_test.go
33
addr_test.go
@@ -11,10 +11,38 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/iris-contrib/httpexpect"
|
||||
"gopkg.in/kataras/iris.v6"
|
||||
"gopkg.in/kataras/iris.v6/httptest"
|
||||
)
|
||||
|
||||
func getRandomNumber(min int, max int) int {
|
||||
rand.Seed(time.Now().Unix())
|
||||
return rand.Intn(max-min) + min
|
||||
}
|
||||
|
||||
const (
|
||||
testEnableSubdomain = true
|
||||
testSubdomain = "mysubdomain"
|
||||
)
|
||||
|
||||
func testSubdomainHost(host string) string {
|
||||
s := testSubdomain + "." + host
|
||||
return s
|
||||
}
|
||||
|
||||
func testSubdomainURL(scheme string, host string) string {
|
||||
subdomainHost := testSubdomainHost(host)
|
||||
return scheme + subdomainHost
|
||||
}
|
||||
|
||||
func subdomainTester(e *httpexpect.Expect, app *iris.Framework) *httpexpect.Expect {
|
||||
es := e.Builder(func(req *httpexpect.Request) {
|
||||
req.WithURL(testSubdomainURL(app.Config.VScheme, app.Config.VHost))
|
||||
})
|
||||
return es
|
||||
}
|
||||
|
||||
func TestParseAddr(t *testing.T) {
|
||||
|
||||
// test hosts
|
||||
@@ -145,11 +173,6 @@ k9X9TwWyZtp5IL1CAEd/Il9ZTXFzr3lNaN8LCFnU+EIsz1YgUW8LTg==
|
||||
`
|
||||
)
|
||||
|
||||
func getRandomNumber(min int, max int) int {
|
||||
rand.Seed(time.Now().Unix())
|
||||
return rand.Intn(max-min) + min
|
||||
}
|
||||
|
||||
// works as
|
||||
// defer listenTLS(iris.Default, hostTLS)()
|
||||
func listenTLS(app *iris.Framework, hostTLS string) func() {
|
||||
|
||||
Reference in New Issue
Block a user