test status code

This commit is contained in:
Chapuis Bertil 2015-09-18 13:02:20 +02:00
parent 7bf9802504
commit 04e8c1e148

View file

@ -38,17 +38,21 @@ func TestRouter(t *testing.T) {
getConfigResp, _ := http.Get(server.URL + "/config")
getConfigBody, _ := ioutil.ReadAll(getConfigResp.Body)
require.Equal(t, 200, getConfigResp.StatusCode)
require.Equal(t, string(getConfig), string(getConfigBody))
postConfigResp, _ := http.Post(server.URL+"/config", "binary/octet-stream", strings.NewReader("post test"))
postConfigBody, _ := ioutil.ReadAll(postConfigResp.Body)
require.Equal(t, 200, postConfigResp.StatusCode)
require.Equal(t, string(postConfig), string(postConfigBody))
getBlobsResp, _ := http.Get(server.URL + "/blobs/")
getBlobsBody, _ := ioutil.ReadAll(getBlobsResp.Body)
require.Equal(t, 200, getBlobsResp.StatusCode)
require.Equal(t, string(getBlobs), string(getBlobsBody))
getBlobResp, _ := http.Get(server.URL + "/blobs/test")
getBlobBody, _ := ioutil.ReadAll(getBlobResp.Body)
require.Equal(t, 200, getBlobResp.StatusCode)
require.Equal(t, string(getBlob), string(getBlobBody))
}