Remove test and frontend packages; app and test context refactoring

This commit is contained in:
Michael Mayer
2019-05-03 18:57:28 +02:00
parent 6cba9d061f
commit 71adb35cff
54 changed files with 1027 additions and 1302 deletions

View File

@@ -5,19 +5,18 @@ import (
"net/http/httptest"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/photoprism/photoprism/internal/test"
"github.com/photoprism/photoprism/internal/context"
)
// API test helper
func NewApiTest() (app *gin.Engine, router *gin.RouterGroup, conf photoprism.Config) {
conf = test.NewConfig()
func NewApiTest() (app *gin.Engine, router *gin.RouterGroup, ctx *context.Context) {
ctx = context.TestContext()
gin.SetMode(gin.TestMode)
app = gin.New()
router = app.Group("/api/v1")
return app, router, conf
return app, router, ctx
}
// See https://medium.com/@craigchilds94/testing-gin-json-responses-1f258ce3b0b1