Skip to content

Instantly share code, notes, and snippets.

@btc
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save btc/0ee8b66cd351b50a70c8 to your computer and use it in GitHub Desktop.

Select an option

Save btc/0ee8b66cd351b50a70c8 to your computer and use it in GitHub Desktop.
package gamecenter
import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
)
func TestShowGameHandler(t *testing.T) {
b := NewMemBackend()
b.CreateGame(Game{})
b.CreateGame(Game{})
r, err := http.NewRequest("GET", "/api/v0/games/1", nil)
if err != nil {
t.Fatal(err)
}
w := httptest.NewRecorder()
Router(b).ServeHTTP(w, r)
if w.Code != http.StatusOK {
t.Fatal(w.Code)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment