Add travis config and drop unused test

This commit is contained in:
Brendan Ward 2017-12-23 13:35:20 -08:00
parent c88b48042f
commit 39b6633876
2 changed files with 20 additions and 69 deletions

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: go
go:
- 1.8
- 1.9
- tip
matrix:
allow_failures:
- go: master
fast_finish: true
before_script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/
- go get github.com/mattn/goveralls
script:
- test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go test -v -race ./... # Run all the tests with the race detector enabled
- go vet ./... # go vet is the official Go static analyzer
- $GOPATH/bin/goveralls -service=travis-ci # Run coverage analysis

View File

@ -1,69 +0,0 @@
package main
import (
"testing"
//
"github.com/labstack/echo"
//"github.com/labstack/echo/test"
//"github.com/stretchr/testify/assert"
// "net/http/httptest"
//"strings"
"net/http/httptest"
)
//
//func request(method, path string, e *echo.Echo) (int, string) {
// req := test.NewRequest(method, path, nil)
// rec := test.NewResponseRecorder()
// e.ServeHTTP(req, rec)
// return rec.Status(), rec.Body.String()
//}
func TestGetServices(t *testing.T) {
//assert := assert.New(t)
e := echo.New()
req := httptest.NewRequest("GET", "/services", nil)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
//c := e.NewContext(standard.NewRequest(req), standard.NewResponse(rec))
if err := ListServices(c); err != nil {
t.Error(err)
}
//assert.NotEqual(1, 0, "should match")
// Setup
//e := echo.New()
//req, err := http.NewRequest(echo.GET, "/services")
//assert.NoError(err)
//assert
//
//
//r := new(http.Request)
//rec := httptest.NewRecorder()
//c := e.NewContext(standard.NewRequest(r, e.Logger()), standard.NewResponse(rec, e.Logger()))
//c, b := request(echo.GET, "/images/walle.png", e)
//assert.Equal(t, http.StatusOK, c)
//assert.NotEmpty(t, b)
//
//assert.Equal(e.Routes(), "foo", "should match")
//c.SetPath("/services")
//h := ListServices(c)
//assert.Equal(h, http.StatusOK, "Should match")
//c.SetParamValues("jon@labstack.com")
//h := &handler{mockDB}
//
//// Assertions
//if assert.NoError(t, h.getUser(c)) {
// assert.Equal(t, http.StatusOK, rec.Code)
// assert.Equal(t, "foo:bar", rec.Body.String())
//}
}