refactor runner

This commit is contained in:
Pedro Nasser
2016-08-21 19:40:08 -03:00
parent 3b5ff970df
commit 8b0d0f1e13
11 changed files with 114 additions and 88 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/iron-io/functions/api/models"
"github.com/iron-io/functions/api/runner"
titancommon "github.com/iron-io/titan/common"
)
@@ -47,6 +48,14 @@ func testRouter() *gin.Engine {
return r
}
func testRunner(t *testing.T) *runner.Runner {
r, err := runner.New()
if err != nil {
t.Fatal("Test: failed to create new runner")
}
return r
}
func routerRequest(t *testing.T, router *gin.Engine, method, path string, body io.Reader) (*http.Request, *httptest.ResponseRecorder) {
req, err := http.NewRequest(method, "http://localhost:8080"+path, body)
if err != nil {