gomdb/gomdb_test.go

39 lines
739 B
Go
Raw Normal View History

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 17:12:01 +00:00
query := &QueryData{Title: "Fight Club", Year: "1999", SearchType: MovieSearch}
resp, err := Search(query)
2015-06-26 17:36:33 +00:00
if err != nil {
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) {
query := &QueryData{Title: "Fight Club", Year: "1999"}
resp, err := MovieByTitle(query)
2015-06-26 17:36:33 +00:00
if err != nil {
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 {
t.Error(err)
return
2015-06-26 17:36:33 +00:00
}
if resp.Title != "Fight Club" {
t.Error("Wrong Movie")
}
}