add a nested parties and wildcard subdomains test

Former-commit-id: c2faa1bd02935ef13c32027f99c097b5c60babef
This commit is contained in:
kataras 2017-08-23 15:26:46 +03:00
parent 531ca5829c
commit 8b5b6b116a
2 changed files with 37 additions and 0 deletions

View File

@ -55,6 +55,32 @@ func registerGamesRoutes(app *iris.Application) {
games.Post("/{gameID:int}/clans/{clanPublicID:int}/memberships/delete", h)
games.Post("/{gameID:int}/clans/{clanPublicID:int}/memberships/promote", h)
games.Post("/{gameID:int}/clans/{clanPublicID:int}/memberships/demote", h)
gamesCh := games.Party("/challenge")
{
// games/challenge
gamesCh.Get("/", h)
gamesChBeginner := gamesCh.Party("/beginner")
{
// games/challenge/beginner/start
gamesChBeginner.Get("/start", h)
levelBeginner := gamesChBeginner.Party("/level")
{
// games/challenge/beginner/level/first
levelBeginner.Get("/first", h)
}
}
gamesChIntermediate := gamesCh.Party("/intermediate")
{
// games/challenge/intermediate
gamesChIntermediate.Get("/", h)
// games/challenge/intermediate/start
gamesChIntermediate.Get("/start", h)
}
}
}
}
@ -62,6 +88,10 @@ func registerSubdomains(app *iris.Application) {
mysubdomain := app.Party("mysubdomain.")
// http://mysubdomain.myhost.com
mysubdomain.Get("/", h)
willdcardSubdomain := app.Party("*.")
willdcardSubdomain.Get("/", h)
willdcardSubdomain.Party("/party").Get("/", h)
}
func newApp() *iris.Application {

View File

@ -81,7 +81,14 @@ func TestRouting(t *testing.T) {
newTroute("GET", "", "/games/{gameID}/clans", httptest.StatusOK, "gameID", "42"),
newTroute("GET", "", "/games/{gameID}/clans/clan/{clanPublicID}", httptest.StatusOK, "gameID", "42", "clanPublicID", "93"),
newTroute("GET", "", "/games/{gameID}/clans/search", httptest.StatusOK, "gameID", "42"),
newTroute("GET", "", "/games/challenge", httptest.StatusOK),
newTroute("GET", "", "/games/challenge/beginner/start", httptest.StatusOK),
newTroute("GET", "", "/games/challenge/beginner/level/first", httptest.StatusOK),
newTroute("GET", "", "/games/challenge/intermediate", httptest.StatusOK),
newTroute("GET", "", "/games/challenge/intermediate/start", httptest.StatusOK),
newTroute("GET", "mysubdomain", "/", httptest.StatusOK),
newTroute("GET", "mywildcardsubdomain", "/", httptest.StatusOK),
newTroute("GET", "mywildcardsubdomain", "/party", httptest.StatusOK),
// PUT
newTroute("PUT", "", "/games/{gameID}/players/{clanPublicID}", httptest.StatusOK, "gameID", "42", "clanPublicID", "93"),
newTroute("PUT", "", "/games/{gameID}/clans/clan/{clanPublicID}", httptest.StatusOK, "gameID", "42", "clanPublicID", "93"),