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
702 B
Go
40 lines
702 B
Go
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")
|
|
}
|
|
}
|