Testing for cover art content type

This commit is contained in:
Deluan 2016-03-03 14:41:00 -05:00
parent 18b784f494
commit 79a6965f99
2 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,6 @@ func (c *GetCoverArtController) Get() {
c.SendError(responses.ERROR_DATA_NOT_FOUND, "cover art not available")
}
c.Ctx.Output.ContentType("image/jpg")
c.Ctx.Output.Body(img)
}

View File

@ -43,12 +43,14 @@ func TestGetCoverArt(t *testing.T) {
_, w := getCoverArt("id=NOT_FOUND")
So(w.Body.Bytes(), ShouldMatchMD5, "963552b04e87a5a55e993f98a0fbdf82")
So(w.Header().Get("Content-Type"), ShouldEqual, "image/png")
})
Convey("When id is found", func() {
mockMediaFileRepo.SetData(`[{"Id":"2","HasCoverArt":true,"Path":"tests/fixtures/01 Invisible (RED) Edit Version.mp3"}]`, 1)
_, w := getCoverArt("id=2")
So(w.Body.Bytes(), ShouldMatchMD5, "e859a71cd1b1aaeb1ad437d85b306668")
So(w.Header().Get("Content-Type"), ShouldEqual, "image/jpeg")
})
Reset(func() {
mockMediaFileRepo.SetData("[]", 0)