Tests: Refactor unit tests

This commit is contained in:
theresa 2022-03-30 11:44:25 +02:00
parent 4798ebb9d8
commit f0479b5163
11 changed files with 22 additions and 132 deletions

View file

@ -199,17 +199,12 @@ func TestPhotosFilterColor(t *testing.T) {
f.Color = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -458,17 +453,12 @@ func TestPhotosQueryColor(t *testing.T) {
f.Query = "color:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -185,17 +185,12 @@ func TestPhotosFilterCountry(t *testing.T) {
f.Country = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -430,17 +425,12 @@ func TestPhotosQueryCountry(t *testing.T) {
f.Query = "country:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -190,17 +190,12 @@ func TestPhotosFilterDay(t *testing.T) {
f.Day = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -441,17 +436,12 @@ func TestPhotosQueryDay(t *testing.T) {
f.Query = "day:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -191,17 +191,12 @@ import (
f.Face = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -450,17 +445,12 @@ func TestPhotosQueryFace(t *testing.T) {
f.Query = "face:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -182,17 +182,12 @@ package search
f.Faces = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -433,17 +428,12 @@ func TestPhotosQueryFaces(t *testing.T) {
f.Query = "faces:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -185,17 +185,12 @@ func TestPhotosFilterHash(t *testing.T) {
f.Hash = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -430,17 +425,12 @@ func TestPhotosQueryHash(t *testing.T) {
f.Query = "hash:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -190,17 +190,12 @@ func TestPhotosFilterMonth(t *testing.T) {
f.Month = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -441,17 +436,12 @@ func TestPhotosQueryMonth(t *testing.T) {
f.Query = "month:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -189,17 +189,12 @@ func TestPhotosFilterState(t *testing.T) {
f.State = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -436,17 +431,12 @@ func TestPhotosQueryState(t *testing.T) {
f.Query = "state:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -185,17 +185,12 @@ func TestPhotosFilterType(t *testing.T) {
f.Type = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -430,17 +425,12 @@ func TestPhotosQueryType(t *testing.T) {
f.Query = "type:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -185,17 +185,12 @@ func TestPhotosFilterUid(t *testing.T) {
f.UID = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -430,17 +425,12 @@ func TestPhotosQueryUid(t *testing.T) {
f.Query = "uid:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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)
})
t.Run("EndsWithPipe", func(t *testing.T) {

View file

@ -190,17 +190,12 @@ func TestPhotosFilterYear(t *testing.T) {
f.Year = "Red|Green"
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {
@ -441,17 +436,12 @@ func TestPhotosQueryYear(t *testing.T) {
f.Query = "year:\"Red|Green\""
f.Merged = true
photos, count, err := Photos(f)
photos, _, err := Photos(f)
if err != nil {
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))
})
t.Run("EndsWithPipe", func(t *testing.T) {