示例#1
0
文件: season_test.go 项目: tvtio/tmdb
func Test404GetSeason(t *testing.T) {
	tmdb := New()
	_, err := tmdb.GetSeason("foo", "bar") // Do not exist
	if err != nil && err.Error() != "404 Not Found" {
		t.Errorf("It should fail with '404 Not Found', but got: %v", err)
	}
}
示例#2
0
文件: season_test.go 项目: tvtio/tmdb
func TestGetSeason(t *testing.T) {
	tmdb := New()
	_, err := tmdb.GetSeason("456", "1") // The Simpsons Season 1
	if err != nil {
		t.Errorf("It should not fail, but got an error: %s", err)
	}
}
示例#3
0
文件: season_test.go 项目: tvtio/tmdb
func TestBadAPIKeyGetSeason(t *testing.T) {
	tmdb := New()
	tmdb.APIKey = "foo"
	_, err := tmdb.GetSeason("456", "1") // The Simpsons Season 1
	if err != nil && err.Error() != "401 Unauthorized" {
		t.Errorf("It should fail with '401 Unauthorized', but got: %v", err)
	}
}
示例#4
0
文件: season_test.go 项目: tvtio/tmdb
func TestBadURLGetSeason(t *testing.T) {
	tmdb := New()
	tmdb.BaseURL, _ = url.Parse("http://foo.bar/")
	_, err := tmdb.GetSeason("456", "1") // The Simpsons Season 1
	if err == nil {
		t.Errorf("It should fail because the BaseURL %s, does not exist.", tmdb.BaseURL)
	}
}