mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	* Fixes #7152 - Allow create/update/delete message to be empty, use default message * Linting fix * Fix to delete integration tests
This commit is contained in:
		@@ -23,7 +23,7 @@ func getDeleteFileOptions() *api.DeleteFileOptions {
 | 
			
		||||
		FileOptions: api.FileOptions{
 | 
			
		||||
			BranchName:    "master",
 | 
			
		||||
			NewBranchName: "master",
 | 
			
		||||
			Message:       "Updates new/file.txt",
 | 
			
		||||
			Message:       "Removing the file new/file.txt",
 | 
			
		||||
			Author: api.Identity{
 | 
			
		||||
				Name:  "John Doe",
 | 
			
		||||
				Email: "johndoe@example.com",
 | 
			
		||||
@@ -89,6 +89,20 @@ func TestAPIDeleteFile(t *testing.T) {
 | 
			
		||||
		DecodeJSON(t, resp, &fileResponse)
 | 
			
		||||
		assert.NotNil(t, fileResponse)
 | 
			
		||||
		assert.Nil(t, fileResponse.Content)
 | 
			
		||||
		assert.EqualValues(t, deleteFileOptions.Message+"\n", fileResponse.Commit.Message)
 | 
			
		||||
 | 
			
		||||
		// Test deleting file without a message
 | 
			
		||||
		fileID++
 | 
			
		||||
		treePath = fmt.Sprintf("delete/file%d.txt", fileID)
 | 
			
		||||
		createFile(user2, repo1, treePath)
 | 
			
		||||
		deleteFileOptions = getDeleteFileOptions()
 | 
			
		||||
		deleteFileOptions.Message = ""
 | 
			
		||||
		url = fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s?token=%s", user2.Name, repo1.Name, treePath, token2)
 | 
			
		||||
		req = NewRequestWithJSON(t, "DELETE", url, &deleteFileOptions)
 | 
			
		||||
		resp = session.MakeRequest(t, req, http.StatusOK)
 | 
			
		||||
		DecodeJSON(t, resp, &fileResponse)
 | 
			
		||||
		expectedMessage := "Delete '" + treePath + "'\n"
 | 
			
		||||
		assert.EqualValues(t, expectedMessage, fileResponse.Commit.Message)
 | 
			
		||||
 | 
			
		||||
		// Test deleting a file with the wrong SHA
 | 
			
		||||
		fileID++
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user