2023-01-22 10:38:55 -09:00
|
|
|
package tests
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/deluan/rest"
|
|
|
|
|
"github.com/navidrome/navidrome/model"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type MockPlaylistRepo struct {
|
|
|
|
|
model.PlaylistRepository
|
|
|
|
|
|
2026-02-15 18:36:58 -09:00
|
|
|
Entity *model.Playlist
|
|
|
|
|
Error error
|
|
|
|
|
TracksReturn model.PlaylistTrackRepository
|
2023-01-22 10:38:55 -09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *MockPlaylistRepo) Get(_ string) (*model.Playlist, error) {
|
|
|
|
|
if m.Error != nil {
|
|
|
|
|
return nil, m.Error
|
|
|
|
|
}
|
|
|
|
|
if m.Entity == nil {
|
|
|
|
|
return nil, model.ErrNotFound
|
|
|
|
|
}
|
|
|
|
|
return m.Entity, nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-15 18:36:58 -09:00
|
|
|
func (m *MockPlaylistRepo) Tracks(_ string, _ bool) model.PlaylistTrackRepository {
|
|
|
|
|
return m.TracksReturn
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-22 10:38:55 -09:00
|
|
|
func (m *MockPlaylistRepo) Count(_ ...rest.QueryOptions) (int64, error) {
|
|
|
|
|
if m.Error != nil {
|
|
|
|
|
return 0, m.Error
|
|
|
|
|
}
|
|
|
|
|
if m.Entity == nil {
|
|
|
|
|
return 0, nil
|
|
|
|
|
}
|
|
|
|
|
return 1, nil
|
|
|
|
|
}
|