mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Path filter for scenes and galleries (#834)
This commit is contained in:
@@ -125,6 +125,34 @@ func galleryQueryQ(t *testing.T, qb models.GalleryQueryBuilder, q string, expect
|
||||
assert.Len(t, galleries, totalGalleries)
|
||||
}
|
||||
|
||||
func TestGalleryQueryPath(t *testing.T) {
|
||||
const galleryIdx = 1
|
||||
galleryPath := getGalleryStringValue(galleryIdx, "Path")
|
||||
|
||||
pathCriterion := models.StringCriterionInput{
|
||||
Value: galleryPath,
|
||||
Modifier: models.CriterionModifierEquals,
|
||||
}
|
||||
|
||||
verifyGalleriesPath(t, pathCriterion)
|
||||
|
||||
pathCriterion.Modifier = models.CriterionModifierNotEquals
|
||||
verifyGalleriesPath(t, pathCriterion)
|
||||
}
|
||||
|
||||
func verifyGalleriesPath(t *testing.T, pathCriterion models.StringCriterionInput) {
|
||||
sqb := models.NewGalleryQueryBuilder()
|
||||
galleryFilter := models.GalleryFilterType{
|
||||
Path: &pathCriterion,
|
||||
}
|
||||
|
||||
galleries, _ := sqb.Query(&galleryFilter, nil)
|
||||
|
||||
for _, gallery := range galleries {
|
||||
verifyString(t, gallery.Path, pathCriterion)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGalleryQueryIsMissingScene(t *testing.T) {
|
||||
qb := models.NewGalleryQueryBuilder()
|
||||
isMissing := "scene"
|
||||
|
||||
Reference in New Issue
Block a user