Tests: Refactor unit tests
This commit is contained in:
parent
4798ebb9d8
commit
f0479b5163
|
@ -199,17 +199,12 @@ func TestPhotosFilterColor(t *testing.T) {
|
||||||
f.Color = "Red|Green"
|
f.Color = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photosredorgreen), len(photos))
|
assert.Equal(t, len(photosredorgreen), len(photos))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -458,17 +453,12 @@ func TestPhotosQueryColor(t *testing.T) {
|
||||||
f.Query = "color:\"Red|Green\""
|
f.Query = "color:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photosredorgreen), len(photos))
|
assert.Equal(t, len(photosredorgreen), len(photos))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -185,17 +185,12 @@ func TestPhotosFilterCountry(t *testing.T) {
|
||||||
f.Country = "Red|Green"
|
f.Country = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -430,17 +425,12 @@ func TestPhotosQueryCountry(t *testing.T) {
|
||||||
f.Query = "country:\"Red|Green\""
|
f.Query = "country:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -190,17 +190,12 @@ func TestPhotosFilterDay(t *testing.T) {
|
||||||
f.Day = "Red|Green"
|
f.Day = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -441,17 +436,12 @@ func TestPhotosQueryDay(t *testing.T) {
|
||||||
f.Query = "day:\"Red|Green\""
|
f.Query = "day:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -191,17 +191,12 @@ import (
|
||||||
f.Face = "Red|Green"
|
f.Face = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -450,17 +445,12 @@ func TestPhotosQueryFace(t *testing.T) {
|
||||||
f.Query = "face:\"Red|Green\""
|
f.Query = "face:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -182,17 +182,12 @@ package search
|
||||||
f.Faces = "Red|Green"
|
f.Faces = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -433,17 +428,12 @@ func TestPhotosQueryFaces(t *testing.T) {
|
||||||
f.Query = "faces:\"Red|Green\""
|
f.Query = "faces:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -185,17 +185,12 @@ func TestPhotosFilterHash(t *testing.T) {
|
||||||
f.Hash = "Red|Green"
|
f.Hash = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -430,17 +425,12 @@ func TestPhotosQueryHash(t *testing.T) {
|
||||||
f.Query = "hash:\"Red|Green\""
|
f.Query = "hash:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -190,17 +190,12 @@ func TestPhotosFilterMonth(t *testing.T) {
|
||||||
f.Month = "Red|Green"
|
f.Month = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -441,17 +436,12 @@ func TestPhotosQueryMonth(t *testing.T) {
|
||||||
f.Query = "month:\"Red|Green\""
|
f.Query = "month:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -189,17 +189,12 @@ func TestPhotosFilterState(t *testing.T) {
|
||||||
f.State = "Red|Green"
|
f.State = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -436,17 +431,12 @@ func TestPhotosQueryState(t *testing.T) {
|
||||||
f.Query = "state:\"Red|Green\""
|
f.Query = "state:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -185,17 +185,12 @@ func TestPhotosFilterType(t *testing.T) {
|
||||||
f.Type = "Red|Green"
|
f.Type = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -430,17 +425,12 @@ func TestPhotosQueryType(t *testing.T) {
|
||||||
f.Query = "type:\"Red|Green\""
|
f.Query = "type:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -185,17 +185,12 @@ func TestPhotosFilterUid(t *testing.T) {
|
||||||
f.UID = "Red|Green"
|
f.UID = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -430,17 +425,12 @@ func TestPhotosQueryUid(t *testing.T) {
|
||||||
f.Query = "uid:\"Red|Green\""
|
f.Query = "uid:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), 0)
|
assert.Equal(t, len(photos), 0)
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
|
@ -190,17 +190,12 @@ func TestPhotosFilterYear(t *testing.T) {
|
||||||
f.Year = "Red|Green"
|
f.Year = "Red|Green"
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
@ -441,17 +436,12 @@ func TestPhotosQueryYear(t *testing.T) {
|
||||||
f.Query = "year:\"Red|Green\""
|
f.Query = "year:\"Red|Green\""
|
||||||
f.Merged = true
|
f.Merged = true
|
||||||
|
|
||||||
photos, count, err := Photos(f)
|
photos, _, err := Photos(f)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(photos) != 1 {
|
|
||||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
|
||||||
t.Logf("query results: %#v", photos)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, len(photos), len(photos0))
|
assert.Equal(t, len(photos), len(photos0))
|
||||||
})
|
})
|
||||||
t.Run("EndsWithPipe", func(t *testing.T) {
|
t.Run("EndsWithPipe", func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue