Skip to content

Commit

Permalink
Fix API test
Browse files Browse the repository at this point in the history
  • Loading branch information
aanand committed Feb 17, 2014
1 parent 94a6972 commit 1ca341c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ func TestCreateHost(t *testing.T) {
}

body, _ := ioutil.ReadAll(r.Body)
var data map[string]string
var data map[string]interface{}
json.Unmarshal(body, &data)

if data["name"] != "newhost" {
t.Errorf("expected 'newhost', got '%s'", data["name"])
}

if int(data["size"].(float64)) != 512 {
t.Errorf("expected 512, got %#v", data["size"])
}

w.WriteHeader(201)
fmt.Fprintln(w, `{
"id": "14dff6d8-3b9a-41be-9ffd-d0d054a17492",
Expand All @@ -67,7 +71,7 @@ func TestCreateHost(t *testing.T) {

client := HTTPClient{ts.URL, "dummy_token"}

host, err := client.CreateHost("newhost")
host, err := client.CreateHost("newhost", 512)
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 1ca341c

Please sign in to comment.