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" ) type TestLogger struct{} func (t TestLogger) Debug(format string, a ...interface{}) {} func (t TestLogger) Info(format string, a ...interface{}) {} func (t TestLogger) Warn(format string, a ...interface{}) {} func TestApplication(t *testing.T) { is := is.New(t) logger := TestLogger{} file_service := dataswamp.NewSwampFileService( namespace.NewRepository(), swampfile.NewRepository(), 1000, time.Hour, logger, ) bog := Bog{ router: new(http.ServeMux), file_service: file_service, address: "fake", logger: logger, } 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) }