Skip to content
Snippets Groups Projects
Commit 220aadb2 authored by Christian Pointner's avatar Christian Pointner
Browse files

fix test cases

parent e67001ee
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,7 @@ func (st *Store) UpdateFileSourceHash(show string, id uint64, hash string) (*Fil
return st.updateFile(show, id, "source__hash", hash)
}
func (st *Store) getFileUsage(id uint64, playlists []Playlist) (err error) {
func (st *Store) getFileUsage(id uint64, playlists *[]Playlist) (err error) {
sub := st.db.Model(PlaylistEntry{}).Select("playlist_id").Where("file_id = ?", id).Group("playlist_id").SubQuery()
err = st.db.Where("id in ?", sub).Find(playlists).Error
return
......@@ -197,7 +197,7 @@ func (st *Store) GetFileUsage(show string, id uint64) (playlists []Playlist, err
if cnt == 0 {
return nil, ErrNotFound
}
err = st.getFileUsage(id, playlists)
err = st.getFileUsage(id, &playlists)
return
}
......@@ -208,7 +208,7 @@ func (st *Store) DeleteFile(show string, id uint64) (err error) {
if err = result.Error; err != nil {
// we assume this is due to a FK constraint -> file in use by playlist_entry
usageErr := &ErrFileInUse{}
if err = st.getFileUsage(id, usageErr.Playlists); err != nil {
if err = st.getFileUsage(id, &usageErr.Playlists); err != nil {
return
}
return usageErr
......
......@@ -200,7 +200,7 @@ func TestMigrations(t *testing.T) {
// Shows
//
func checkShows(t *testing.T, shows Shows, expected []string) {
func checkShows(t *testing.T, shows []Show, expected []string) {
// if len(shows) != len(expected) {
// t.Fatalf("expected %d shows in store but got %d: %v", len(expected), len(shows), shows)
// }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment