navidrome/tests/mock_share_repo.go

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

36 lines
587 B
Go
Raw Normal View History

2021-06-08 22:30:19 +02:00
package tests
import (
"github.com/deluan/rest"
"github.com/navidrome/navidrome/model"
)
type MockShareRepo struct {
model.ShareRepository
rest.Repository
rest.Persistable
Entity interface{}
ID string
2021-06-08 22:30:19 +02:00
Cols []string
2021-08-22 17:46:52 +02:00
Error error
2021-06-08 22:30:19 +02:00
}
func (m *MockShareRepo) Save(entity interface{}) (string, error) {
2021-08-22 17:46:52 +02:00
if m.Error != nil {
return "", m.Error
}
2021-06-08 22:30:19 +02:00
m.Entity = entity
2021-08-22 17:46:52 +02:00
return "id", nil
2021-06-08 22:30:19 +02:00
}
func (m *MockShareRepo) Update(id string, entity interface{}, cols ...string) error {
2021-08-22 17:46:52 +02:00
if m.Error != nil {
return m.Error
}
m.ID = id
2021-06-08 22:30:19 +02:00
m.Entity = entity
m.Cols = cols
2021-08-22 17:46:52 +02:00
return nil
2021-06-08 22:30:19 +02:00
}