Skip to content

Instantly share code, notes, and snippets.

@calvinchengx
Created November 4, 2013 07:42
Show Gist options
  • Select an option

  • Save calvinchengx/7299314 to your computer and use it in GitHub Desktop.

Select an option

Save calvinchengx/7299314 to your computer and use it in GitHub Desktop.
package event
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/suite"
"hp/db"
)
func TestEventNextHandler(t *testing.T) {
db.Connect("localhost", "test_db")
db.RegisterAllIndexes()
// integration test on http requests to EventNextHandler
request, _ := http.NewRequest("GET", "/events/next/", nil)
response := httptest.NewRecorder()
EventNextHandler(response, request)
if response.Code != http.StatusOK {
t.Fatalf("Non-expected status code%v:\n\tbody: %v", "200", response.Code)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment