mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-20 16:10:50 +00:00
Use httptest in integration tests (#3080)
This commit is contained in:
parent
993b86628b
commit
e59adcde65
12 changed files with 77 additions and 100 deletions
|
@ -25,12 +25,12 @@ func assertProtectedBranch(t *testing.T, repoID int64, branchName string, isErr,
|
|||
|
||||
resp := MakeRequest(t, req, NoExpectedStatus)
|
||||
if isErr {
|
||||
assert.EqualValues(t, http.StatusInternalServerError, resp.HeaderCode)
|
||||
assert.EqualValues(t, http.StatusInternalServerError, resp.Code)
|
||||
} else {
|
||||
assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
|
||||
assert.EqualValues(t, http.StatusOK, resp.Code)
|
||||
var branch models.ProtectedBranch
|
||||
t.Log(string(resp.Body))
|
||||
assert.NoError(t, json.Unmarshal(resp.Body, &branch))
|
||||
t.Log(resp.Body.String())
|
||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), &branch))
|
||||
assert.Equal(t, canPush, !branch.IsProtected())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue