mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +03:00
- Create model.DataStore, with provision for transactions - Change all layers dependencies on repositories to use DataStore - Implemented persistence.SQLStore - Removed iTunes Bridge/Importer support
31 lines
764 B
Go
31 lines
764 B
Go
package persistence
|
|
|
|
import (
|
|
"github.com/astaxie/beego/orm"
|
|
"github.com/cloudsonic/sonic-server/model"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("PropertyRepository", func() {
|
|
var repo model.PropertyRepository
|
|
|
|
BeforeEach(func() {
|
|
repo = NewPropertyRepository(orm.NewOrm())
|
|
repo.(*propertyRepository).DeleteAll()
|
|
})
|
|
|
|
It("saves and retrieves data", func() {
|
|
Expect(repo.Put("1", "test")).To(BeNil())
|
|
Expect(repo.Get("1")).To(Equal("test"))
|
|
})
|
|
|
|
It("returns default if data is not found", func() {
|
|
Expect(repo.DefaultGet("2", "default")).To(Equal("default"))
|
|
})
|
|
|
|
It("returns value if found", func() {
|
|
Expect(repo.Put("3", "test")).To(BeNil())
|
|
Expect(repo.DefaultGet("3", "default")).To(Equal("test"))
|
|
})
|
|
})
|