2021-08-26 16:31:05 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2021-08-28 13:55:37 +02:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2021-08-26 16:31:05 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFaces_Embeddings(t *testing.T) {
|
|
|
|
m := FaceFixtures.Get("joe-biden")
|
|
|
|
m1 := FaceFixtures.Get("jane-doe")
|
|
|
|
r := Faces{m, m1}.Embeddings()
|
|
|
|
len1 := len(m.Embedding())
|
|
|
|
len2 := len(m1.Embedding())
|
|
|
|
assert.Equal(t, len1+len2, len(r[0])+len(r[1]))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFaces_IDs(t *testing.T) {
|
|
|
|
m := FaceFixtures.Get("joe-biden")
|
|
|
|
m1 := FaceFixtures.Get("jane-doe")
|
|
|
|
r := Faces{m, m1}.IDs()
|
|
|
|
assert.Equal(t, []string{"VF7ANLDET2BKZNT4VQWJMMC6HBEFDOG6", "VF7ANLDET2BKZNT4VQWJMMC6HBEFDOG7"}, r)
|
|
|
|
}
|
2021-09-29 20:09:34 +02:00
|
|
|
|
|
|
|
func TestDeleteOrphanFaces(t *testing.T) {
|
2022-10-13 22:11:02 +02:00
|
|
|
t.Run("Ok", func(t *testing.T) {
|
2021-09-29 20:09:34 +02:00
|
|
|
if count, err := DeleteOrphanFaces(); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
} else {
|
|
|
|
t.Logf("deleted %d faces", count)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|