Test: Add test for api/download
This commit is contained in:
parent
c647908d3d
commit
47ae1e2b65
1 changed files with 27 additions and 0 deletions
27
internal/api/download_test.go
Normal file
27
internal/api/download_test.go
Normal 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)
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue