2020-01-16 21:56:24 +01:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
import (
|
2020-01-18 07:56:17 +01:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
2020-01-19 21:37:41 +01:00
|
|
|
"github.com/astaxie/beego/orm"
|
2020-01-16 21:56:24 +01:00
|
|
|
"github.com/cloudsonic/sonic-server/model"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("MediaFileRepository", func() {
|
|
|
|
var repo model.MediaFileRepository
|
|
|
|
|
|
|
|
BeforeEach(func() {
|
2020-01-19 21:37:41 +01:00
|
|
|
repo = NewMediaFileRepository(orm.NewOrm())
|
2020-01-16 21:56:24 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
Describe("FindByPath", func() {
|
|
|
|
It("returns all records from a given ArtistID", func() {
|
2020-01-18 07:56:17 +01:00
|
|
|
path := string(os.PathSeparator) + filepath.Join("beatles", "1")
|
|
|
|
Expect(repo.FindByPath(path)).To(Equal(model.MediaFiles{
|
2020-01-16 21:56:24 +01:00
|
|
|
songComeTogether,
|
|
|
|
}))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|