mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-18 00:59:38 +00:00
Adds the ability to override a lens's Make/Model (e.g. fixing Pentax lenses that ExifTool decodes as `4 38`) via a new photoprism lenses update CLI command and a `PUT /api/v1/lenses/:id endpoint`, plus a `GET /api/v1/lenses` search endpoint, a new lenses ACL resource, and an lenses ls list command.
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package query
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/photoprism/photoprism/internal/entity"
|
|
)
|
|
|
|
func TestFindLensBySlug(t *testing.T) {
|
|
t.Run("ExistingLens", func(t *testing.T) {
|
|
lens := FindLensBySlug(entity.LensFixtures.Get("4.15mm-f/2.2").LensSlug)
|
|
assert.NotNil(t, lens)
|
|
if lens != nil {
|
|
assert.Equal(t, entity.LensFixtures.Get("4.15mm-f/2.2").ID, lens.ID)
|
|
assert.Equal(t, entity.LensFixtures.Get("4.15mm-f/2.2").LensModel, lens.LensModel)
|
|
}
|
|
})
|
|
t.Run("NotExistingLens", func(t *testing.T) {
|
|
lens := FindLensBySlug("IAmNotValid")
|
|
assert.Nil(t, lens)
|
|
})
|
|
}
|
|
|
|
func TestFindLensByID(t *testing.T) {
|
|
t.Run("ExistingLens", func(t *testing.T) {
|
|
lens := FindLensByID(entity.LensFixtures.Get("4.15mm-f/2.2").ID)
|
|
assert.NotNil(t, lens)
|
|
if lens != nil {
|
|
assert.Equal(t, entity.LensFixtures.Get("4.15mm-f/2.2").ID, lens.ID)
|
|
assert.Equal(t, entity.LensFixtures.Get("4.15mm-f/2.2").LensModel, lens.LensModel)
|
|
}
|
|
})
|
|
t.Run("NotExistingLens", func(t *testing.T) {
|
|
lens := FindLensByID(99885541348)
|
|
assert.Nil(t, lens)
|
|
})
|
|
}
|