navidrome/tests/mock_transcoding_repo.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
742 B
Go
Raw Normal View History

2020-10-27 16:01:40 +01:00
package tests
import "github.com/navidrome/navidrome/model"
2021-06-08 22:30:19 +02:00
type MockTranscodingRepo struct {
model.TranscodingRepository
}
2021-06-08 22:30:19 +02:00
func (m *MockTranscodingRepo) Get(id string) (*model.Transcoding, error) {
return &model.Transcoding{ID: id, TargetFormat: "mp3", DefaultBitRate: 160}, nil
}
2021-06-08 22:30:19 +02:00
func (m *MockTranscodingRepo) FindByFormat(format string) (*model.Transcoding, error) {
switch format {
case "mp3":
return &model.Transcoding{ID: "mp31", TargetFormat: "mp3", DefaultBitRate: 160}, nil
case "oga":
return &model.Transcoding{ID: "oga1", TargetFormat: "oga", DefaultBitRate: 128}, nil
case "opus":
return &model.Transcoding{ID: "opus1", TargetFormat: "opus", DefaultBitRate: 96}, nil
default:
return nil, model.ErrNotFound
}
}