Makes album getter test pass
This commit is contained in:
@@ -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
|
||||
}()
|
||||
|
||||
24
album_description_getter_test.go
Normal file
24
album_description_getter_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
2
testdata/albums.json
vendored
2
testdata/albums.json
vendored
@@ -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"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user