Implemented rest of track tests

This commit is contained in:
Matthieu Grieger 2016-06-21 23:01:54 -07:00
parent ae4d863dd2
commit 9160c02bee

View file

@ -21,15 +21,19 @@ type TrackTestSuite struct {
func (suite *TrackTestSuite) SetupTest() { func (suite *TrackTestSuite) SetupTest() {
duration, _ := time.ParseDuration("1s") duration, _ := time.ParseDuration("1s")
offset, _ := time.ParseDuration("2ms")
suite.Track = Track{ suite.Track = Track{
ID: "id", ID: "id",
URL: "url",
Title: "title", Title: "title",
Author: "author", Author: "author",
AuthorURL: "author_url",
Submitter: "submitter", Submitter: "submitter",
Service: "service", Service: "service",
Filename: "filename", Filename: "filename",
ThumbnailURL: "thumbnailurl", ThumbnailURL: "thumbnailurl",
Duration: duration, Duration: duration,
PlaybackOffset: offset,
Playlist: new(Playlist), Playlist: new(Playlist),
} }
} }
@ -38,6 +42,10 @@ func (suite *TrackTestSuite) TestGetID() {
suite.Equal("id", suite.Track.GetID()) suite.Equal("id", suite.Track.GetID())
} }
func (suite *TrackTestSuite) TestGetURL() {
suite.Equal("url", suite.Track.GetURL())
}
func (suite *TrackTestSuite) TestGetTitle() { func (suite *TrackTestSuite) TestGetTitle() {
suite.Equal("title", suite.Track.GetTitle()) suite.Equal("title", suite.Track.GetTitle())
} }
@ -46,6 +54,10 @@ func (suite *TrackTestSuite) TestGetAuthor() {
suite.Equal("author", suite.Track.GetAuthor()) suite.Equal("author", suite.Track.GetAuthor())
} }
func (suite *TrackTestSuite) TestGetAuthorURL() {
suite.Equal("author_url", suite.Track.GetAuthorURL())
}
func (suite *TrackTestSuite) TestGetSubmitter() { func (suite *TrackTestSuite) TestGetSubmitter() {
suite.Equal("submitter", suite.Track.GetSubmitter()) suite.Equal("submitter", suite.Track.GetSubmitter())
} }
@ -88,6 +100,12 @@ func (suite *TrackTestSuite) TestGetDuration() {
suite.Equal(duration, suite.Track.GetDuration()) suite.Equal(duration, suite.Track.GetDuration())
} }
func (suite *TrackTestSuite) TestGetPlaybackOffset() {
duration, _ := time.ParseDuration("2ms")
suite.Equal(duration, suite.Track.GetPlaybackOffset())
}
func (suite *TrackTestSuite) TestGetPlaylistWhenExists() { func (suite *TrackTestSuite) TestGetPlaylistWhenExists() {
result := suite.Track.GetPlaylist() result := suite.Track.GetPlaylist()