Added size parameter to getCoverArt.view endpoint
This commit is contained in:
@@ -3,16 +3,17 @@ package api_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
. "github.com/deluan/gosonic/tests"
|
||||
"github.com/deluan/gosonic/tests/mocks"
|
||||
"github.com/deluan/gosonic/utils"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"github.com/astaxie/beego"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func getCoverArt(params ...string) (*http.Request, *httptest.ResponseRecorder) {
|
||||
@@ -52,6 +53,13 @@ func TestGetCoverArt(t *testing.T) {
|
||||
So(w.Body.Bytes(), ShouldMatchMD5, "e859a71cd1b1aaeb1ad437d85b306668")
|
||||
So(w.Header().Get("Content-Type"), ShouldEqual, "image/jpeg")
|
||||
})
|
||||
Convey("When specifying a size", func() {
|
||||
mockMediaFileRepo.SetData(`[{"Id":"2","HasCoverArt":true,"Path":"tests/fixtures/01 Invisible (RED) Edit Version.mp3"}]`, 1)
|
||||
_, w := getCoverArt("id=2", "size=100")
|
||||
|
||||
So(w.Body.Bytes(), ShouldMatchMD5, "04378f523ca3e8ead33bf7140d39799e")
|
||||
So(w.Header().Get("Content-Type"), ShouldEqual, "image/jpeg")
|
||||
})
|
||||
Reset(func() {
|
||||
mockMediaFileRepo.SetData("[]", 0)
|
||||
mockMediaFileRepo.SetError(false)
|
||||
|
||||
Reference in New Issue
Block a user