diff options
author | Richard Mahn <richmahn@users.noreply.github.com> | 2019-06-29 11:19:24 -0400 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-06-29 16:19:24 +0100 |
commit | 002b597c1f87cd5c69d32053a62f57c08d48d3ee (patch) | |
tree | c14ccd9f1a1b02e21759a4fcae569d8c8116df4f /integrations/repofiles_delete_test.go | |
parent | 462284e2f5768cf04d71c7abd8c01eef20cff73d (diff) | |
download | gitea-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/repofiles_delete_test.go')
-rw-r--r-- | integrations/repofiles_delete_test.go | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/integrations/repofiles_delete_test.go b/integrations/repofiles_delete_test.go index c3bb18ec9c..f4cb4510be 100644 --- a/integrations/repofiles_delete_test.go +++ b/integrations/repofiles_delete_test.go @@ -24,40 +24,32 @@ func getDeleteRepoFileOptions(repo *models.Repository) *repofiles.DeleteRepoFile TreePath: "README.md", Message: "Deletes README.md", SHA: "4b4851ad51df6a7d9f25c979345979eaeb5b349f", - Author: nil, - Committer: nil, + Author: &repofiles.IdentityOptions{ + Name: "Bob Smith", + Email: "bob@smith.com", + }, + Committer: nil, } } func getExpectedDeleteFileResponse(u *url.URL) *api.FileResponse { + // Just returns fields that don't change, i.e. fields with commit SHAs and dates can't be determined return &api.FileResponse{ Content: nil, Commit: &api.FileCommitResponse{ - CommitMeta: api.CommitMeta{ - URL: u.String() + "api/v1/repos/user2/repo1/git/commits/65f1bf27bc3bf70f64657658635e66094edbcb4d", - SHA: "65f1bf27bc3bf70f64657658635e66094edbcb4d", - }, - HTMLURL: u.String() + "user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d", Author: &api.CommitUser{ Identity: api.Identity{ - Name: "user1", - Email: "address1@example.com", + Name: "Bob Smith", + Email: "bob@smith.com", }, - Date: "2017-03-19T20:47:59Z", }, Committer: &api.CommitUser{ Identity: api.Identity{ - Name: "Ethan Koenig", - Email: "ethantkoenig@gmail.com", + Name: "Bob Smith", + Email: "bob@smith.com", }, - Date: "2017-03-19T20:47:59Z", - }, - Parents: []*api.CommitMeta{}, - Message: "Initial commit\n", - Tree: &api.CommitMeta{ - URL: u.String() + "api/v1/repos/user2/repo1/git/trees/2a2f1d4670728a2e10049e345bd7a276468beab6", - SHA: "2a2f1d4670728a2e10049e345bd7a276468beab6", }, + Message: "Deletes README.md\n", }, Verification: &api.PayloadCommitVerification{ Verified: false, @@ -89,7 +81,12 @@ func testDeleteRepoFile(t *testing.T, u *url.URL) { fileResponse, err := repofiles.DeleteRepoFile(repo, doer, opts) assert.Nil(t, err) expectedFileResponse := getExpectedDeleteFileResponse(u) - assert.EqualValues(t, expectedFileResponse, fileResponse) + assert.NotNil(t, fileResponse) + assert.Nil(t, fileResponse.Content) + assert.EqualValues(t, expectedFileResponse.Commit.Message, fileResponse.Commit.Message) + assert.EqualValues(t, expectedFileResponse.Commit.Author.Identity, fileResponse.Commit.Author.Identity) + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Identity, fileResponse.Commit.Committer.Identity) + assert.EqualValues(t, expectedFileResponse.Verification, fileResponse.Verification) }) t.Run("Verify README.md has been deleted", func(t *testing.T) { @@ -124,7 +121,12 @@ func testDeleteRepoFileWithoutBranchNames(t *testing.T, u *url.URL) { fileResponse, err := repofiles.DeleteRepoFile(repo, doer, opts) assert.Nil(t, err) expectedFileResponse := getExpectedDeleteFileResponse(u) - assert.EqualValues(t, expectedFileResponse, fileResponse) + assert.NotNil(t, fileResponse) + assert.Nil(t, fileResponse.Content) + assert.EqualValues(t, expectedFileResponse.Commit.Message, fileResponse.Commit.Message) + assert.EqualValues(t, expectedFileResponse.Commit.Author.Identity, fileResponse.Commit.Author.Identity) + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Identity, fileResponse.Commit.Committer.Identity) + assert.EqualValues(t, expectedFileResponse.Verification, fileResponse.Verification) }) } |