diff --git a/api/graphql/resolvers/album_test.go b/api/graphql/resolvers/album_test.go index 5623bff9..dff9beaf 100644 --- a/api/graphql/resolvers/album_test.go +++ b/api/graphql/resolvers/album_test.go @@ -1,16 +1,11 @@ package resolvers_test import ( - // "context" "testing" 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/resolvers" - // "github.com/pkg/errors" - // "gorm.io/gorm" "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql/handler" @@ -18,16 +13,6 @@ import ( "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) { 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{ Database: db, }}))) @@ -135,7 +118,40 @@ func TestAlbumCover(t *testing.T) { Title, Path, AlbumID }}`, &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{ { diff --git a/api/graphql/resolvers/resolvers_test.go b/api/graphql/resolvers/resolvers_test.go new file mode 100644 index 00000000..5cc39cee --- /dev/null +++ b/api/graphql/resolvers/resolvers_test.go @@ -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)) +} diff --git a/api/scanner/face_detection/face_detector.go b/api/scanner/face_detection/face_detector.go index 8b0f8742..506cb887 100644 --- a/api/scanner/face_detection/face_detector.go +++ b/api/scanner/face_detection/face_detector.go @@ -39,8 +39,6 @@ func InitializeFaceDetector(db *gorm.DB) error { 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{ rec: rec, faceDescriptors: faceDescriptors,