Test: Add test for api/download

This commit is contained in:
Theresa Gresch 2020-02-02 18:41:18 +01:00
parent c647908d3d
commit 47ae1e2b65

View file

@ -0,0 +1,27 @@
package api
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetDownload(t *testing.T) {
t.Run("could not find original", func(t *testing.T) {
app, router, conf := NewApiTest()
GetDownload(router, conf)
result := PerformRequest(app, "GET", "/api/v1/download/123xxx")
assert.Equal(t, http.StatusNotFound, result.Code)
})
t.Run("download existing not existing file", func(t *testing.T) {
app, router, conf := NewApiTest()
DownloadAlbum(router, conf)
result := PerformRequest(app, "GET", "/api/v1/download/555")
assert.Equal(t, http.StatusNotFound, result.Code)
})
}