mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
fail gracefully
This commit is contained in:
parent
338f266410
commit
e17a9b92d5
1 changed files with 9 additions and 3 deletions
|
@ -32,14 +32,18 @@ func TestMain(t *testing.T) {
|
|||
// test custom domain redirect
|
||||
resp, err := getTestHTTPSClient().Get("https://calciumdibromid.localhost.mock.directory:4430")
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, http.StatusTemporaryRedirect, resp.StatusCode)
|
||||
if !assert.EqualValues(t, http.StatusTemporaryRedirect, resp.StatusCode) {
|
||||
t.FailNow()
|
||||
}
|
||||
assert.EqualValues(t, "https://www.cabr2.de/", resp.Header["Location"][0])
|
||||
assert.EqualValues(t, 0, getSize(resp.Body))
|
||||
|
||||
// test get image
|
||||
resp, err = getTestHTTPSClient().Get("https://magiclike.localhost.mock.directory:4430/images/827679288a.jpg")
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, http.StatusOK, resp.StatusCode)
|
||||
if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) {
|
||||
t.FailNow()
|
||||
}
|
||||
assert.EqualValues(t, "image/jpeg", resp.Header["Content-Type"][0])
|
||||
assert.EqualValues(t, "124635", resp.Header["Content-Length"][0])
|
||||
assert.EqualValues(t, 124635, getSize(resp.Body))
|
||||
|
@ -47,7 +51,9 @@ func TestMain(t *testing.T) {
|
|||
// specify branch
|
||||
resp, err = getTestHTTPSClient().Get("https://momar.localhost.mock.directory:4430/pag/@master/")
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, http.StatusOK, resp.StatusCode)
|
||||
if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) {
|
||||
t.FailNow()
|
||||
}
|
||||
assert.EqualValues(t, "text/html; charset=utf-8", resp.Header["Content-Type"][0])
|
||||
assert.True(t, getSize(resp.Body) > 1000)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue