-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathtv_episodes_test.go
108 lines (91 loc) · 3.85 KB
/
tv_episodes_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package tmdb
func (suite *TMBDTestSuite) TestGetTVEpisodeDetails() {
got, err := suite.client.GetTVEpisodeDetails(gotID, 1, 1, nil)
suite.Nil(err)
suite.Equal("2011-04-17", got.AirDate)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeDetailsFail() {
_, err := suite.client.GetTVEpisodeDetails(0, 1, 1, nil)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeDetailsWithOptions() {
options := make(map[string]string)
options["language"] = "pt-BR"
got, err := suite.client.GetTVEpisodeDetails(gotID, 1, 1, options)
suite.Nil(err)
suite.Equal("2011-04-17", got.AirDate)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeChanges() {
got, err := suite.client.GetTVEpisodeChanges(gotEpisodeID, nil)
suite.Nil(err)
suite.NotNil(got.Changes)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeChangesFail() {
options := make(map[string]string)
options["start_date"] = "2019-01-14"
options["end_date"] = "2019-01-25"
options["page"] = "1"
_, err := suite.client.GetTVEpisodeChanges(0, options)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeChangesWithOptions() {
options := make(map[string]string)
options["start_date"] = "2019-01-14"
options["end_date"] = "2019-01-25"
options["page"] = "1"
got, err := suite.client.GetTVEpisodeChanges(gotEpisodeID, options)
suite.Nil(err)
suite.NotNil("overview", got.Changes[0].Key)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeCredits() {
got, err := suite.client.GetTVEpisodeCredits(gotID, 1, 1)
suite.Nil(err)
suite.Equal(int64(gotEpisodeID), got.ID)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeCreditsFail() {
_, err := suite.client.GetTVEpisodeCredits(0, 1, 1)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeExternalIDs() {
got, err := suite.client.GetTVEpisodeExternalIDs(gotID, 1, 1)
suite.Nil(err)
suite.Equal(int64(gotEpisodeID), got.ID)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeExternalIDsFail() {
_, err := suite.client.GetTVEpisodeExternalIDs(0, 1, 1)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeImages() {
got, err := suite.client.GetTVEpisodeImages(gotID, 1, 1)
suite.Nil(err)
suite.Equal(int64(gotEpisodeID), got.ID)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeImagesFail() {
_, err := suite.client.GetTVEpisodeImages(0, 1, 1)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeTranslations() {
got, err := suite.client.GetTVEpisodeTranslations(gotID, 1, 1)
suite.Nil(err)
suite.Equal(int64(gotEpisodeID), got.ID)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeTranslationsFail() {
_, err := suite.client.GetTVEpisodeTranslations(0, 1, 1)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeVideos() {
got, err := suite.client.GetTVEpisodeVideos(gotID, 1, 1, nil)
suite.Nil(err)
suite.Equal(int64(gotEpisodeID), got.ID)
}
func (suite *TMBDTestSuite) TestGetTVEpisodeVideosFail() {
_, err := suite.client.GetTVEpisodeVideos(0, 1, 2, nil)
suite.Equal("code: 6 | success: false | message: Invalid id: The pre-requisite id is invalid or not found.", err.Error())
}
func (suite *TMBDTestSuite) TestGetTVEpisodeVideosWithOptions() {
options := make(map[string]string)
options["language"] = "en-US"
got, err := suite.client.GetTVEpisodeVideos(gotID, 1, 2, options)
suite.Nil(err)
suite.Equal(int64(63057), got.ID)
}