Makes album getter test pass

This commit is contained in:
2016-01-20 13:47:43 +01:00
parent bc0e3a392b
commit c215dcb849
3 changed files with 36 additions and 5 deletions

View File

@@ -119,7 +119,10 @@ func (g *AlbumDescriptionGetter) Get(a *Album) error {
return
}
for _, s := range sList {
a.Scenarist = append(a.Scenarist, linkFromSelection(s.Find("a")))
l := linkFromSelection(s.Find("a"))
if len(l.Title) > 0 {
a.Scenarist = append(a.Scenarist, l)
}
}
errors <- nil
}()
@@ -132,7 +135,10 @@ func (g *AlbumDescriptionGetter) Get(a *Album) error {
return
}
for _, s := range sList {
a.Designer = append(a.Designer, linkFromSelection(s.Find("a")))
l := linkFromSelection(s.Find("a"))
if len(l.Title) > 0 {
a.Designer = append(a.Designer, l)
}
}
errors <- nil
}()
@@ -145,7 +151,10 @@ func (g *AlbumDescriptionGetter) Get(a *Album) error {
return
}
for _, s := range sList {
a.Colorist = append(a.Colorist, linkFromSelection(s.Find("a")))
l := linkFromSelection(s.Find("a"))
if len(l.Title) > 0 {
a.Colorist = append(a.Colorist, l)
}
}
errors <- nil
}()

View File

@@ -0,0 +1,24 @@
package main
import . "gopkg.in/check.v1"
type AlbumDescriptionGetterSuite struct {
g *AlbumDescriptionGetter
}
var _ = Suite(&AlbumDescriptionGetterSuite{})
func (s *AlbumDescriptionGetterSuite) SetUpTest(c *C) {
s.g = &AlbumDescriptionGetter{getter: testGetter}
}
func (s *AlbumDescriptionGetterSuite) TestGet(c *C) {
for _, a := range albumsDataTest {
aStripped := StripNonCsvField(a)
if c.Check(s.g.Get(&aStripped), IsNil) == true {
aStripped.FetchDate = a.FetchDate
c.Check(aStripped, DeepEquals, a)
}
}
}

View File

@@ -67,7 +67,6 @@
"Target": "http://www.bedetheque.com/auteur-839-BD-Loro.html"
}
],
"Colorist": [ ],
"FetchDate": "0001-01-01T00:00:00Z"
},
{
@@ -488,7 +487,6 @@
"Target": "http://www.bedetheque.com/auteur-17-BD-Bruyninx-Marc.html"
}
],
"Colorist": [ ],
"FetchDate": "0001-01-01T00:00:00Z"
},
{