Seems to be getting confused with MYSQL env. variable. Maybe this will work?
This commit is contained in:
parent
82f4785f2b
commit
f7b0723cde
|
@ -1,16 +1,11 @@
|
||||||
package resolvers_test
|
package resolvers_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "context"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
api "github.com/photoview/photoview/api/graphql"
|
api "github.com/photoview/photoview/api/graphql"
|
||||||
// "github.com/photoview/photoview/api/graphql/auth"
|
|
||||||
// "./../generated"
|
|
||||||
"github.com/photoview/photoview/api/graphql/models"
|
"github.com/photoview/photoview/api/graphql/models"
|
||||||
"github.com/photoview/photoview/api/graphql/resolvers"
|
"github.com/photoview/photoview/api/graphql/resolvers"
|
||||||
// "github.com/pkg/errors"
|
|
||||||
// "gorm.io/gorm"
|
|
||||||
|
|
||||||
"github.com/99designs/gqlgen/client"
|
"github.com/99designs/gqlgen/client"
|
||||||
"github.com/99designs/gqlgen/graphql/handler"
|
"github.com/99designs/gqlgen/graphql/handler"
|
||||||
|
@ -18,16 +13,6 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
// func NewResolver() api.Config {
|
|
||||||
// r := Resolver{}
|
|
||||||
//
|
|
||||||
// r.Database = test_utils.DatabaseTest(t)
|
|
||||||
//
|
|
||||||
// return api.Config{
|
|
||||||
// Resolvers: &r,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
func TestAlbumCover(t *testing.T) {
|
func TestAlbumCover(t *testing.T) {
|
||||||
db := test_utils.DatabaseTest(t)
|
db := test_utils.DatabaseTest(t)
|
||||||
|
|
||||||
|
@ -115,8 +100,6 @@ func TestAlbumCover(t *testing.T) {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c := client.New(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &resolvers.Resolver{
|
c := client.New(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &resolvers.Resolver{
|
||||||
Database: db,
|
Database: db,
|
||||||
}})))
|
}})))
|
||||||
|
@ -135,7 +118,40 @@ func TestAlbumCover(t *testing.T) {
|
||||||
Title, Path, AlbumID
|
Title, Path, AlbumID
|
||||||
}}`, &resp[2])
|
}}`, &resp[2])
|
||||||
|
|
||||||
|
expected_thumbnails := []*models.Media{
|
||||||
|
{
|
||||||
|
Title: "pic1",
|
||||||
|
Path: "/photos/pic1",
|
||||||
|
AlbumID: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "pic3",
|
||||||
|
Path: "/photos/child1/pic3",
|
||||||
|
AlbumID: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Title: "pic6",
|
||||||
|
Path: "/photos/child2/pic6",
|
||||||
|
AlbumID: 3,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyResult(t, expected_thumbnails, resp)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("Album change cover photos", func(t *testing.T) {
|
||||||
|
|
||||||
|
var resp []*models.Media
|
||||||
|
|
||||||
|
c.MustPost(`query { Thumbnail( album(id:1)) {
|
||||||
|
Title, Path, AlbumID
|
||||||
|
}}`, &resp[0])
|
||||||
|
c.MustPost(`query { Thumbnail( album(id:1)) {
|
||||||
|
Title, Path, AlbumID
|
||||||
|
}}`, &resp[1])
|
||||||
|
c.MustPost(`query { Thumbnail( album(id:1)) {
|
||||||
|
Title, Path, AlbumID
|
||||||
|
}}`, &resp[2])
|
||||||
|
|
||||||
expected_thumbnails := []*models.Media{
|
expected_thumbnails := []*models.Media{
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package resolvers_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/photoview/photoview/api/test_utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
os.Exit(test_utils.IntegrationTestRun(m))
|
||||||
|
}
|
|
@ -39,8 +39,6 @@ func InitializeFaceDetector(db *gorm.DB) error {
|
||||||
return errors.Wrap(err, "get face detection samples from database")
|
return errors.Wrap(err, "get face detection samples from database")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("This is the function where I need to implement the checks for facegroup cover ID")
|
|
||||||
|
|
||||||
GlobalFaceDetector = &FaceDetector{
|
GlobalFaceDetector = &FaceDetector{
|
||||||
rec: rec,
|
rec: rec,
|
||||||
faceDescriptors: faceDescriptors,
|
faceDescriptors: faceDescriptors,
|
||||||
|
|
Loading…
Reference in New Issue