You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
833 B
Go
40 lines
833 B
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
// "fmt"
|
|
"caj-larsson/bog/dataswamp"
|
|
"caj-larsson/bog/infrastructure/memory/namespace"
|
|
"caj-larsson/bog/infrastructure/memory/swampfile"
|
|
"github.com/matryer/is"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func TestApplication(t *testing.T) {
|
|
is := is.New(t)
|
|
file_service := dataswamp.NewSwampFileService(
|
|
namespace.NewRepository(),
|
|
swampfile.NewRepository(),
|
|
1000,
|
|
time.Hour,
|
|
ServerLogger{Debug},
|
|
)
|
|
|
|
bog := Bog{
|
|
router: new(http.ServeMux),
|
|
file_service: file_service,
|
|
address: "fake",
|
|
}
|
|
bog.routes()
|
|
req := httptest.NewRequest("POST", "/apath", strings.NewReader("testdata"))
|
|
req.Header.Add("User-Agent", "testingclient")
|
|
req.Header.Add("Content-Length", "8")
|
|
w := httptest.NewRecorder()
|
|
bog.router.ServeHTTP(w, req)
|
|
|
|
is.Equal(w.Code, 200)
|
|
}
|