Added new route tests
This commit is contained in:
parent
5fc07782b9
commit
e646410fc2
@ -14,6 +14,7 @@ func init() {
|
|||||||
app.Rewrite(func(ctx *aero.RewriteContext) {
|
app.Rewrite(func(ctx *aero.RewriteContext) {
|
||||||
requestURI := ctx.URI()
|
requestURI := ctx.URI()
|
||||||
|
|
||||||
|
// User profiles
|
||||||
if strings.HasPrefix(requestURI, plusRoute) {
|
if strings.HasPrefix(requestURI, plusRoute) {
|
||||||
newURI := "/user/"
|
newURI := "/user/"
|
||||||
userName := requestURI[2:]
|
userName := requestURI[2:]
|
||||||
@ -28,6 +29,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search
|
||||||
if strings.HasPrefix(requestURI, "/search/") {
|
if strings.HasPrefix(requestURI, "/search/") {
|
||||||
searchTerm := requestURI[len("/search/"):]
|
searchTerm := requestURI[len("/search/"):]
|
||||||
ctx.Request.URL.RawQuery = "q=" + searchTerm
|
ctx.Request.URL.RawQuery = "q=" + searchTerm
|
||||||
@ -42,6 +44,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Analytics
|
||||||
if requestURI == "/dark-flame-master" {
|
if requestURI == "/dark-flame-master" {
|
||||||
ctx.SetURI("/api/new/analytics")
|
ctx.SetURI("/api/new/analytics")
|
||||||
return
|
return
|
||||||
|
44
tests.go
44
tests.go
@ -26,6 +26,14 @@ var routeTests = map[string][]string{
|
|||||||
"/+Akyoto/soundtracks",
|
"/+Akyoto/soundtracks",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"/user/:nick/followers": []string{
|
||||||
|
"/+Akyoto/followers",
|
||||||
|
},
|
||||||
|
|
||||||
|
"/user/:nick/stats": []string{
|
||||||
|
"/+Akyoto/stats",
|
||||||
|
},
|
||||||
|
|
||||||
"/user/:nick/animelist": []string{
|
"/user/:nick/animelist": []string{
|
||||||
"/+Akyoto/animelist",
|
"/+Akyoto/animelist",
|
||||||
},
|
},
|
||||||
@ -79,6 +87,10 @@ var routeTests = map[string][]string{
|
|||||||
"/soundtrack/h0ac8sKkg",
|
"/soundtrack/h0ac8sKkg",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"/character/:id": []string{
|
||||||
|
"/character/6556",
|
||||||
|
},
|
||||||
|
|
||||||
// API
|
// API
|
||||||
"/api/anime/:id": []string{
|
"/api/anime/:id": []string{
|
||||||
"/api/anime/1",
|
"/api/anime/1",
|
||||||
@ -148,6 +160,34 @@ var routeTests = map[string][]string{
|
|||||||
"/api/youtubetosoundtrack/hU2wqJuOIp4",
|
"/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
|
||||||
"/images/avatars/large/:file": []string{
|
"/images/avatars/large/:file": []string{
|
||||||
"/images/avatars/large/4J6qpK1ve.webp",
|
"/images/avatars/large/4J6qpK1ve.webp",
|
||||||
@ -187,6 +227,10 @@ var routeTests = map[string][]string{
|
|||||||
"/import/kitsu/animelist/finish": nil,
|
"/import/kitsu/animelist/finish": nil,
|
||||||
"/api/test/notification": nil,
|
"/api/test/notification": nil,
|
||||||
"/api/paypal/payment/create": 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/success": nil,
|
||||||
"/paypal/cancel": nil,
|
"/paypal/cancel": nil,
|
||||||
"/anime/:id/edit": nil,
|
"/anime/:id/edit": nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user