Skip to content

Commit

Permalink
collections tests has been fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cyruzin committed Nov 2, 2023
1 parent bb32d6d commit 9754c5c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions collections_test.go
Original file line number Diff line number Diff line change
@@ -1,63 +1,65 @@
package tmdb

const starWarsID = 10
const collectionID = 10
const collectionIDImage = 2

func (suite *TMBDTestSuite) TestGetCollectionDetails() {
collection, err := suite.client.GetCollectionDetails(starWarsID, nil)
collection, err := suite.client.GetCollectionDetails(collectionID, nil)
suite.Nil(err)
suite.NotNil(collection.ID)
}

func (suite *TMBDTestSuite) TestGetCollectionDetailsFail() {
suite.client.apiKey = ""
_, err := suite.client.GetCollectionDetails(starWarsID, nil)
_, err := suite.client.GetCollectionDetails(collectionID, nil)
suite.NotNil(err)
}

func (suite *TMBDTestSuite) TestGetCollectionDetailsWithOptions() {
options := make(map[string]string)
options["language"] = "pt-BR"
collection, err := suite.client.GetCollectionDetails(starWarsID, options)
collection, err := suite.client.GetCollectionDetails(collectionID, options)
suite.Nil(err)
suite.NotNil(collection.ID)
}

func (suite *TMBDTestSuite) TestGetCollectionImages() {
collection, err := suite.client.GetCollectionImages(starWarsID, nil)
collection, err := suite.client.GetCollectionImages(collectionIDImage, nil)
suite.Nil(err)
suite.NotNil(collection.ID)
}

func (suite *TMBDTestSuite) TestGetCollectionImagesFail() {
suite.client.apiKey = ""
_, err := suite.client.GetCollectionImages(starWarsID, nil)
_, err := suite.client.GetCollectionImages(collectionID, nil)
suite.NotNil(err)
}

func (suite *TMBDTestSuite) TestGetCollectionImagesWithOptions() {
options := make(map[string]string)
options["language"] = "pt-BR"
collection, err := suite.client.GetCollectionImages(starWarsID, options)
options["language"] = "en-US"
options["language"] = "en"
collection, err := suite.client.GetCollectionImages(collectionIDImage, options)
suite.Nil(err)
suite.NotNil(collection.ID)
}

func (suite *TMBDTestSuite) TestGetCollectionTranslations() {
collection, err := suite.client.GetCollectionTranslations(starWarsID, nil)
collection, err := suite.client.GetCollectionTranslations(collectionID, nil)
suite.Nil(err)
suite.NotNil(collection.ID)
}

func (suite *TMBDTestSuite) TestGetCollectionTranslationsFail() {
suite.client.apiKey = ""
_, err := suite.client.GetCollectionTranslations(starWarsID, nil)
_, err := suite.client.GetCollectionTranslations(collectionID, nil)
suite.NotNil(err)
}

func (suite *TMBDTestSuite) TestGetCollectionTranslationsWithOptions() {
options := make(map[string]string)
options["language"] = "pt-BR"
collection, err := suite.client.GetCollectionTranslations(starWarsID, options)
collection, err := suite.client.GetCollectionTranslations(collectionID, options)
suite.Nil(err)
suite.NotNil(collection.ID)
}

0 comments on commit 9754c5c

Please sign in to comment.