Added more route tests

This commit is contained in:
Eduard Urbach 2018-04-25 20:23:35 +02:00
parent ba08b85267
commit a6fea3965c
7 changed files with 45 additions and 2 deletions

View File

@ -74,7 +74,7 @@ func logRequest(ctx *aero.Context, responseTime time.Duration) {
// Notify us about long requests. // Notify us about long requests.
// However ignore requests under /auth/ because those depend on 3rd party servers. // However ignore requests under /auth/ because those depend on 3rd party servers.
if responseTime >= 300*time.Millisecond && !strings.HasPrefix(ctx.URI(), "/auth/") { if responseTime >= 300*time.Millisecond && !strings.HasPrefix(ctx.URI(), "/auth/") && !strings.HasPrefix(ctx.URI(), "/sitemap/") {
err.Error("Long response time", ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI()) err.Error("Long response time", ip, hostName, responseTimeString, ctx.StatusCode, ctx.URI())
} }
} }

View File

@ -3,7 +3,7 @@ package animeroutes
import ( import (
"github.com/aerogo/layout" "github.com/aerogo/layout"
"github.com/animenotifier/notify.moe/pages/anime" "github.com/animenotifier/notify.moe/pages/anime"
"github.com/animenotifier/notify.moe/pages/editanime" "github.com/animenotifier/notify.moe/pages/anime/editanime"
"github.com/animenotifier/notify.moe/pages/episode" "github.com/animenotifier/notify.moe/pages/episode"
"github.com/animenotifier/notify.moe/pages/genre" "github.com/animenotifier/notify.moe/pages/genre"
"github.com/animenotifier/notify.moe/pages/genres" "github.com/animenotifier/notify.moe/pages/genres"

View File

@ -123,6 +123,10 @@ var routeTests = map[string][]string{
"/anime/74y2cFiiR/tracks", "/anime/74y2cFiiR/tracks",
}, },
"/anime/:id/relations": []string{
"/anime/74y2cFiiR/relations",
},
"/thread/:id": []string{ "/thread/:id": []string{
"/thread/HJgS7c2K", "/thread/HJgS7c2K",
}, },
@ -147,6 +151,10 @@ var routeTests = map[string][]string{
"/quote/gUZugd6zR/edit", "/quote/gUZugd6zR/edit",
}, },
"/quote/:id/history": []string{
"/quote/gUZugd6zR/history",
},
"/quotes/from/:index": []string{ "/quotes/from/:index": []string{
"/quotes/from/2", "/quotes/from/2",
}, },
@ -159,6 +167,10 @@ var routeTests = map[string][]string{
"/soundtrack/h0ac8sKkg", "/soundtrack/h0ac8sKkg",
}, },
"/soundtrack/:id/lyrics": []string{
"/soundtrack/vS64GbpzR/lyrics",
},
"/soundtrack/:id/edit": []string{ "/soundtrack/:id/edit": []string{
"/soundtrack/h0ac8sKkg/edit", "/soundtrack/h0ac8sKkg/edit",
}, },
@ -211,6 +223,28 @@ var routeTests = map[string][]string{
"/explore/anime/2011/any/finished/tv", "/explore/anime/2011/any/finished/tv",
}, },
// AMV
"/amv/:id": []string{
"/amv/07scvSWmg",
},
"/amv/:id/edit": []string{
"/amv/07scvSWmg/edit",
},
"/amv/:id/history": []string{
"/amv/07scvSWmg/history",
},
// AMVs
"/amvs/from/:index": []string{
"/amvs/from/3",
},
"/amvs/best/from/:index": []string{
"/amvs/best/from/3",
},
// Redirects // Redirects
"/mal/anime/:id": []string{ "/mal/anime/:id": []string{
"/mal/anime/33352", "/mal/anime/33352",
@ -289,6 +323,10 @@ var routeTests = map[string][]string{
"/anime/74y2cFiiR/episode/5", "/anime/74y2cFiiR/episode/5",
}, },
"/api/amv/:id": []string{
"/api/amv/07scvSWmg",
},
"/api/character/:id": []string{ "/api/character/:id": []string{
"/api/character/dfrNQrmmg-", "/api/character/dfrNQrmmg-",
}, },
@ -380,6 +418,11 @@ var routeTests = map[string][]string{
"/paypal/success": nil, "/paypal/success": nil,
"/paypal/cancel": nil, "/paypal/cancel": nil,
"/anime/:id/edit": nil, "/anime/:id/edit": nil,
"/anime/:id/edit/images": nil,
"/anime/:id/edit/characters": nil,
"/anime/:id/edit/relations": nil,
"/anime/:id/edit/episodes": nil,
"/anime/:id/edit/history": nil,
"/new/thread": nil, "/new/thread": nil,
"/admin/purchases": nil, "/admin/purchases": nil,
"/admin/registrations": nil, "/admin/registrations": nil,