Fix tests and lint errors, plus a bit of refactor
This commit is contained in:
@@ -20,8 +20,12 @@ func (m *MockShareRepo) Save(entity interface{}) (string, error) {
|
||||
if m.Error != nil {
|
||||
return "", m.Error
|
||||
}
|
||||
m.Entity = entity
|
||||
return "id", nil
|
||||
s := entity.(*model.Share)
|
||||
if s.ID == "" {
|
||||
s.ID = "id"
|
||||
}
|
||||
m.Entity = s
|
||||
return s.ID, nil
|
||||
}
|
||||
|
||||
func (m *MockShareRepo) Update(id string, entity interface{}, cols ...string) error {
|
||||
@@ -33,3 +37,10 @@ func (m *MockShareRepo) Update(id string, entity interface{}, cols ...string) er
|
||||
m.Cols = cols
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockShareRepo) Exists(id string) (bool, error) {
|
||||
if m.Error != nil {
|
||||
return false, m.Error
|
||||
}
|
||||
return id == m.ID, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user