Improved tests

This commit is contained in:
Eduard Urbach 2017-06-14 22:13:30 +02:00
parent 1157c519e8
commit eca444ce94
3 changed files with 84 additions and 9 deletions

View File

@ -1,13 +1,14 @@
package main
// import (
// "errors"
// "net/http"
import (
"github.com/aerogo/api"
"github.com/animenotifier/arn"
)
// "github.com/aerogo/aero"
// "github.com/animenotifier/arn"
// "github.com/animenotifier/notify.moe/utils"
// )
func init() {
api := api.New("/api/", arn.DB)
api.Install(app)
}
// func init() {
// // app.Get("/all/anime", func(ctx *aero.Context) string {

View File

@ -1,7 +1,6 @@
package main
import (
"os"
"strconv"
"strings"
"time"
@ -13,7 +12,7 @@ import (
func init() {
err := log.NewChannel("error")
err.AddOutput(log.File("logs/error.log"))
err.AddOutput(os.Stderr)
// err.AddOutput(os.Stderr)
web := log.NewChannel("web")
web.AddOutput(log.File("logs/request.log"))

75
tests.go Normal file
View File

@ -0,0 +1,75 @@
package main
func init() {
// User
app.Test("/user/:nick", []string{
"/+Akyoto",
})
app.Test("/user/:nick/threads", []string{
"/+Akyoto/threads",
})
app.Test("/user/:nick/avatar", []string{
"/+Akyoto/avatar",
})
app.Test("/user/:nick/avatar/small", []string{
"/+Akyoto/avatar/small",
})
// Pages
app.Test("/anime/:id", []string{
"/anime/1",
})
app.Test("/threads/:id", []string{
"/threads/HJgS7c2K",
})
app.Test("/posts/:id", []string{
"/posts/B1RzshnK",
})
app.Test("/forum/:tag", []string{
"/forum/general",
})
// API
app.Test("/api/anime/:id", []string{
"/api/anime/1",
})
app.Test("/api/thread/:id", []string{
"/api/thread/HJgS7c2K",
})
app.Test("/api/post/:id", []string{
"/api/post/B1RzshnK",
})
app.Test("/api/animelist/:id", []string{
"/api/animelist/4J6qpK1ve",
})
app.Test("/api/settings/:id", []string{
"/api/settings/4J6qpK1ve",
})
app.Test("/api/user/:id", []string{
"/api/user/4J6qpK1ve",
})
// Others
app.Test("/images/cover/:file", []string{
"/images/cover/default",
})
app.Test("/images/elements/:file", []string{
"/images/elements/no-gravatar.svg",
})
// Disable
app.Test("/auth/google", nil)
app.Test("/auth/google/callback", nil)
}