mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00
test status code
This commit is contained in:
parent
7bf9802504
commit
04e8c1e148
1 changed files with 4 additions and 0 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue