summaryrefslogtreecommitdiffstats
path: root/integrations/api_repo_file_create_test.go
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-06-29 11:19:24 -0400
committerzeripath <art27@cantab.net>2019-06-29 16:19:24 +0100
commit002b597c1f87cd5c69d32053a62f57c08d48d3ee (patch)
treec14ccd9f1a1b02e21759a4fcae569d8c8116df4f /integrations/api_repo_file_create_test.go
parent462284e2f5768cf04d71c7abd8c01eef20cff73d (diff)
downloadgitea-002b597c1f87cd5c69d32053a62f57c08d48d3ee.tar.gz
gitea-002b597c1f87cd5c69d32053a62f57c08d48d3ee.zip
Fixes #7152 - Allow create/update/delete message to be empty, use default message (#7324)
* Fixes #7152 - Allow create/update/delete message to be empty, use default message * Linting fix * Fix to delete integration tests
Diffstat (limited to 'integrations/api_repo_file_create_test.go')
-rw-r--r--integrations/api_repo_file_create_test.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/integrations/api_repo_file_create_test.go b/integrations/api_repo_file_create_test.go
index 973ed9dfa5..b00583c191 100644
--- a/integrations/api_repo_file_create_test.go
+++ b/integrations/api_repo_file_create_test.go
@@ -28,7 +28,7 @@ func getCreateFileOptions() api.CreateFileOptions {
FileOptions: api.FileOptions{
BranchName: "master",
NewBranchName: "master",
- Message: "Creates new/file.txt",
+ Message: "Making this new file new/file.txt",
Author: api.Identity{
Name: "John Doe",
Email: "johndoe@example.com",
@@ -150,6 +150,19 @@ func TestAPICreateFile(t *testing.T) {
assert.EqualValues(t, expectedSHA, fileResponse.Content.SHA)
assert.EqualValues(t, expectedHTMLURL, fileResponse.Content.HTMLURL)
assert.EqualValues(t, expectedDownloadURL, fileResponse.Content.DownloadURL)
+ assert.EqualValues(t, createFileOptions.Message+"\n", fileResponse.Commit.Message)
+
+ // Test creating a file without a message
+ createFileOptions = getCreateFileOptions()
+ createFileOptions.Message = ""
+ fileID++
+ treePath = fmt.Sprintf("new/file%d.txt", fileID)
+ 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.StatusCreated)
+ DecodeJSON(t, resp, &fileResponse)
+ expectedMessage := "Add '" + treePath + "'\n"
+ assert.EqualValues(t, expectedMessage, fileResponse.Commit.Message)
// Test trying to create a file that already exists, should fail
createFileOptions = getCreateFileOptions()