Added new route tests

This commit is contained in:
Eduard Urbach 2017-10-01 07:24:56 +02:00
parent 5fc07782b9
commit e646410fc2
2 changed files with 69 additions and 22 deletions

View File

@ -14,6 +14,7 @@ func init() {
app.Rewrite(func(ctx *aero.RewriteContext) {
requestURI := ctx.URI()
// User profiles
if strings.HasPrefix(requestURI, plusRoute) {
newURI := "/user/"
userName := requestURI[2:]
@ -28,6 +29,7 @@ func init() {
return
}
// Search
if strings.HasPrefix(requestURI, "/search/") {
searchTerm := requestURI[len("/search/"):]
ctx.Request.URL.RawQuery = "q=" + searchTerm
@ -42,6 +44,7 @@ func init() {
return
}
// Analytics
if requestURI == "/dark-flame-master" {
ctx.SetURI("/api/new/analytics")
return

View File

@ -26,6 +26,14 @@ var routeTests = map[string][]string{
"/+Akyoto/soundtracks",
},
"/user/:nick/followers": []string{
"/+Akyoto/followers",
},
"/user/:nick/stats": []string{
"/+Akyoto/stats",
},
"/user/:nick/animelist": []string{
"/+Akyoto/animelist",
},
@ -79,6 +87,10 @@ var routeTests = map[string][]string{
"/soundtrack/h0ac8sKkg",
},
"/character/:id": []string{
"/character/6556",
},
// API
"/api/anime/:id": []string{
"/api/anime/1",
@ -148,6 +160,34 @@ var routeTests = map[string][]string{
"/api/youtubetosoundtrack/hU2wqJuOIp4",
},
"/api/userfollows/:id": []string{
"/api/userfollows/4J6qpK1ve",
},
"/api/anilisttoanime/:id": []string{
"/api/anilisttoanime/527",
},
"/api/animecharacters/:id": []string{
"/api/animecharacters/323",
},
"/api/animeepisodes/:id": []string{
"/api/animeepisodes/323",
},
"/api/character/:id": []string{
"/api/character/6556",
},
"/api/pushsubscriptions/:id": []string{
"/api/pushsubscriptions/4J6qpK1ve",
},
"/api/myanimelisttoanime/:id": []string{
"/api/myanimelisttoanime/527",
},
// Images
"/images/avatars/large/:file": []string{
"/images/avatars/large/4J6qpK1ve.webp",
@ -174,28 +214,32 @@ var routeTests = map[string][]string{
},
// Disable these tests because they require authorization
"/auth/google": nil,
"/auth/google/callback": nil,
"/auth/facebook": nil,
"/auth/facebook/callback": nil,
"/import": nil,
"/import/anilist/animelist": nil,
"/import/anilist/animelist/finish": nil,
"/import/myanimelist/animelist": nil,
"/import/myanimelist/animelist/finish": nil,
"/import/kitsu/animelist": nil,
"/import/kitsu/animelist/finish": nil,
"/api/test/notification": nil,
"/api/paypal/payment/create": nil,
"/paypal/success": nil,
"/paypal/cancel": nil,
"/anime/:id/edit": nil,
"/new/thread": nil,
"/new/soundtrack": nil,
"/editor": nil,
"/user": nil,
"/settings": nil,
"/extension/embed": nil,
"/auth/google": nil,
"/auth/google/callback": nil,
"/auth/facebook": nil,
"/auth/facebook/callback": nil,
"/import": nil,
"/import/anilist/animelist": nil,
"/import/anilist/animelist/finish": nil,
"/import/myanimelist/animelist": nil,
"/import/myanimelist/animelist/finish": nil,
"/import/kitsu/animelist": nil,
"/import/kitsu/animelist/finish": nil,
"/api/test/notification": nil,
"/api/paypal/payment/create": nil,
"/api/userfollows/:id/get/:item": nil,
"/api/userfollows/:id/get/:item/:property": nil,
"/api/pushsubscriptions/:id/get/:item": nil,
"/api/pushsubscriptions/:id/get/:item/:property": nil,
"/paypal/success": nil,
"/paypal/cancel": nil,
"/anime/:id/edit": nil,
"/new/thread": nil,
"/new/soundtrack": nil,
"/editor": nil,
"/user": nil,
"/settings": nil,
"/extension/embed": nil,
}
// API interfaces