Halfway of getNowPlaying implementation

This commit is contained in:
Deluan 2016-03-17 09:34:32 -04:00
parent a3238ce17b
commit 68c456e188
13 changed files with 113 additions and 29 deletions

View file

@ -11,24 +11,26 @@ func CreateMockNowPlayingRepo() *MockNowPlaying {
type MockNowPlaying struct {
NowPlayingRepository
id string
start time.Time
err bool
info NowPlayingInfo
err bool
}
func (m *MockNowPlaying) SetError(err bool) {
m.err = err
}
func (m *MockNowPlaying) Set(id string) error {
func (m *MockNowPlaying) Set(id, username string, playerId int, playerName string) error {
if m.err {
return errors.New("Error!")
}
m.id = id
m.start = time.Now()
m.info.TrackId = id
m.info.Username = username
m.info.Start = time.Now()
m.info.PlayerId = playerId
m.info.PlayerName = playerName
return nil
}
func (m *MockNowPlaying) Current() (string, time.Time) {
return m.id, m.start
func (m *MockNowPlaying) Current() NowPlayingInfo {
return m.info
}