adding xhttp package tests for checking that endpoints return a correct status code according if google chrome and/or unoconv are disabled in the configuration

This commit is contained in:
Julien Neuhart
2019-08-19 17:21:30 +02:00
parent 08c97f280f
commit daf7cb9d6b
5 changed files with 241 additions and 90 deletions

View File

@@ -2,8 +2,6 @@ package test
import (
"io"
"net/http"
"net/http/httptest"
"os"
"testing"
@@ -11,14 +9,6 @@ import (
"golang.org/x/sync/errgroup"
)
// AssertStatusCode checks if the given request
// returns the expected status code.
func AssertStatusCode(t *testing.T, expectedStatusCode int, srv http.Handler, req *http.Request) {
rec := httptest.NewRecorder()
srv.ServeHTTP(rec, req)
assert.Equal(t, expectedStatusCode, rec.Code)
}
// AssertDirectoryEmpty checks if given directory
// is empty.
func AssertDirectoryEmpty(t *testing.T, directory string) {