2015-06-26 20:07:46 +00:00
|
|
|
package gomdb
|
2015-06-26 17:36:33 +00:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestImdbSearchMovies(t *testing.T) {
|
2016-06-14 16:52:21 +00:00
|
|
|
query := &QueryData{Title: "Fight Club", Year: "1999"}
|
|
|
|
resp, err := Search(query)
|
2015-06-26 17:36:33 +00:00
|
|
|
if err != nil {
|
2016-06-14 16:52:21 +00:00
|
|
|
t.Error(err)
|
|
|
|
return
|
2015-06-26 17:36:33 +00:00
|
|
|
}
|
|
|
|
if resp.Search[0].Title != "Fight Club" {
|
|
|
|
t.Error("Wrong Movie")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestImdbGetMovieByTitle(t *testing.T) {
|
2016-06-14 16:52:21 +00:00
|
|
|
query := &QueryData{Title: "Fight Club", Year: "1999"}
|
|
|
|
resp, err := MovieByTitle(query)
|
2015-06-26 17:36:33 +00:00
|
|
|
if err != nil {
|
2016-06-14 16:52:21 +00:00
|
|
|
t.Error(err)
|
|
|
|
return
|
2015-06-26 17:36:33 +00:00
|
|
|
}
|
|
|
|
if resp.Title != "Fight Club" {
|
|
|
|
t.Error("Wrong Movie")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestImdbGetMovieByImdbID(t *testing.T) {
|
2015-07-17 20:16:57 +00:00
|
|
|
resp, err := MovieByImdbID("tt0137523")
|
2015-06-26 17:36:33 +00:00
|
|
|
if err != nil {
|
2016-06-14 16:52:21 +00:00
|
|
|
t.Error(err)
|
|
|
|
return
|
2015-06-26 17:36:33 +00:00
|
|
|
}
|
|
|
|
if resp.Title != "Fight Club" {
|
|
|
|
t.Error("Wrong Movie")
|
|
|
|
}
|
|
|
|
}
|