parent
c72df43568
commit
a70e8ef74b
@ -0,0 +1,39 @@
|
|||||||
|
package application
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http/httptest"
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"caj-larsson/bog/domain"
|
||||||
|
"caj-larsson/bog/test/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestApplication(t *testing.T) {
|
||||||
|
|
||||||
|
file_service := domain.NewBogFileService(
|
||||||
|
mock.NewMockUserAgentRepository(),
|
||||||
|
mock.NewMockFileRepository(),
|
||||||
|
1000,
|
||||||
|
time.Hour,
|
||||||
|
)
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
bog.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if (w.Code != 200){
|
||||||
|
fmt.Printf("%v", w)
|
||||||
|
t.Error("not ok")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue