Add getShares and createShare Subsonic endpoints

This commit is contained in:
Deluan
2023-01-22 14:38:55 -05:00
parent 94cc2b2ac5
commit d0dceae094
21 changed files with 257 additions and 56 deletions
@@ -527,6 +527,47 @@ var _ = Describe("Responses", func() {
})
})
Describe("Shares", func() {
BeforeEach(func() {
response.Shares = &Shares{}
})
Context("without data", func() {
It("should match .XML", func() {
Expect(xml.Marshal(response)).To(MatchSnapshot())
})
It("should match .JSON", func() {
Expect(json.Marshal(response)).To(MatchSnapshot())
})
})
Context("with data", func() {
BeforeEach(func() {
t := time.Time{}
share := Share{
ID: "ABC123",
Url: "http://localhost/p/ABC123",
Description: "Check it out!",
Username: "deluan",
Created: t,
Expires: &t,
LastVisited: t,
VisitCount: 2,
}
share.Entry = make([]Child, 2)
share.Entry[0] = Child{Id: "1", Title: "title", Album: "album", Artist: "artist", Duration: 120}
share.Entry[1] = Child{Id: "2", Title: "title 2", Album: "album", Artist: "artist", Duration: 300}
response.Shares.Share = []Share{share}
})
It("should match .XML", func() {
Expect(xml.Marshal(response)).To(MatchSnapshot())
})
It("should match .JSON", func() {
Expect(json.Marshal(response)).To(MatchSnapshot())
})
})
})
Describe("Bookmarks", func() {
BeforeEach(func() {
response.Bookmarks = &Bookmarks{}