Fix tests and lint errors, plus a bit of refactor

This commit is contained in:
Deluan
2023-01-22 12:25:35 -05:00
parent 72a12e344e
commit 94cc2b2ac5
14 changed files with 114 additions and 98 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ func (s *shareService) loadMediafiles(ctx context.Context, filter squirrel.Eq, s
func (s *shareService) loadPlaylistTracks(ctx context.Context, id string) (model.MediaFiles, error) {
// Create a context with a fake admin user, to be able to access playlists
ctx = request.WithUser(context.TODO(), model.User{IsAdmin: true})
ctx = request.WithUser(ctx, model.User{IsAdmin: true})
tracks, err := s.ds.Playlist(ctx).Tracks(id, true).GetAll(model.QueryOptions{Sort: "id"})
if err != nil {
+2 -2
View File
@@ -29,7 +29,7 @@ var _ = Describe("Share", func() {
})
Describe("Save", func() {
It("it adds a random name", func() {
It("it sets a random ID", func() {
entity := &model.Share{Description: "test"}
id, err := repo.Save(entity)
Expect(err).ToNot(HaveOccurred())
@@ -44,7 +44,7 @@ var _ = Describe("Share", func() {
err := repo.Update("id", entity)
Expect(err).ToNot(HaveOccurred())
Expect(mockedRepo.(*tests.MockShareRepo).Entity).To(Equal("entity"))
Expect(mockedRepo.(*tests.MockShareRepo).Cols).To(ConsistOf("description"))
Expect(mockedRepo.(*tests.MockShareRepo).Cols).To(ConsistOf("description", "expires_at"))
})
})
})