1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-12 21:47:19 +00:00

Handle expected errors in FileCreate & FileUpdate API (#11643) (#11718)

as title

needed for #11641
This commit is contained in:
6543
2020-06-01 08:28:52 +02:00
committed by GitHub
parent 249e22bb98
commit 70739c32a9
4 changed files with 57 additions and 4 deletions

View File

@ -189,7 +189,7 @@ func TestAPICreateFile(t *testing.T) {
treePath = "README.md"
url = fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s?token=%s", user2.Name, repo1.Name, treePath, token2)
req = NewRequestWithJSON(t, "POST", url, &createFileOptions)
resp = session.MakeRequest(t, req, http.StatusInternalServerError)
resp = session.MakeRequest(t, req, http.StatusUnprocessableEntity)
expectedAPIError := context.APIError{
Message: "repository file already exists [path: " + treePath + "]",
URL: setting.API.SwaggerURL,