-
Notifications
You must be signed in to change notification settings - Fork 57
/
collections_test.go
39 lines (33 loc) · 1.33 KB
/
collections_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tmdb
import (
. "gopkg.in/check.v1"
)
const avengersCollectionID int = 86311
func (s *TmdbSuite) TestGetCollectionInfo(c *C) {
collection, err := s.tmdb.GetCollectionInfo(avengersCollectionID, nil)
s.baseTest(&collection, err, c)
c.Assert(collection.ID, Equals, avengersCollectionID)
c.Assert(collection.Parts, NotNil)
c.Assert(collection.Parts, Not(HasLen), 0)
c.Assert(collection.Images, Not(NotNil))
var options = make(map[string]string)
options["append_to_response"] = "images"
collectionImages, err := s.tmdb.GetCollectionInfo(avengersCollectionID, options)
s.baseTest(&collectionImages, err, c)
c.Assert(collectionImages.ID, Equals, avengersCollectionID)
c.Assert(collectionImages.Parts, NotNil)
c.Assert(collectionImages.Parts, Not(HasLen), 0)
c.Assert(collectionImages.Images, NotNil)
}
func (s *TmdbSuite) TestGetCollectionImages(c *C) {
images, err := s.tmdb.GetCollectionImages(avengersCollectionID, nil)
s.baseTest(&images, err, c)
c.Assert(images.ID, Equals, avengersCollectionID)
backdropLength := len(images.Backdrops)
var options = make(map[string]string)
options["language"] = "en"
enImages, err := s.tmdb.GetCollectionImages(avengersCollectionID, options)
s.baseTest(&enImages, err, c)
c.Assert(enImages.ID, Equals, avengersCollectionID)
c.Assert(len(enImages.Backdrops) < backdropLength, Equals, true)
}