diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index bbb028eb7bb..552a78cbd27 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -1694,19 +1694,6 @@ is_fsck_enabled: true close_issues_via_commit_in_any_branch: false -- - id: 59 - owner_id: 2 - owner_name: user2 - lower_name: test_commit_revert - name: test_commit_revert - default_branch: main - is_empty: false - is_archived: false - is_private: true - status: 0 - num_issues: 0 - - id: 60 owner_id: 40 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index b3bece5589c..976a236011c 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -67,7 +67,7 @@ num_followers: 2 num_following: 1 num_stars: 2 - num_repos: 15 + num_repos: 14 num_teams: 0 num_members: 0 visibility: 0 diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/HEAD b/tests/gitea-repositories-meta/user2/test_commit_revert.git/HEAD deleted file mode 100644 index b870d82622c..00000000000 --- a/tests/gitea-repositories-meta/user2/test_commit_revert.git/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/main diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/config b/tests/gitea-repositories-meta/user2/test_commit_revert.git/config deleted file mode 100644 index 57bbcba5bee..00000000000 --- a/tests/gitea-repositories-meta/user2/test_commit_revert.git/config +++ /dev/null @@ -1,8 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = true - ignorecase = true - precomposeunicode = true -[remote "origin"] - url = https://try.gitea.io/me-heer/test_commit_revert.git diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.idx b/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.idx deleted file mode 100644 index 77bcbe7fb4c..00000000000 Binary files a/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.idx and /dev/null differ diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.pack b/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.pack deleted file mode 100644 index 7271cdaeb87..00000000000 Binary files a/tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.pack and /dev/null differ diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/packed-refs b/tests/gitea-repositories-meta/user2/test_commit_revert.git/packed-refs deleted file mode 100644 index 1f546d7fd51..00000000000 --- a/tests/gitea-repositories-meta/user2/test_commit_revert.git/packed-refs +++ /dev/null @@ -1,3 +0,0 @@ -# pack-refs with: peeled fully-peeled sorted -46aa6ab2c881ae90e15d9ccfc947d1625c892ce5 refs/heads/develop -deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7 refs/heads/main diff --git a/tests/gitea-repositories-meta/user2/test_commit_revert.git/refs/heads/main b/tests/gitea-repositories-meta/user2/test_commit_revert.git/refs/heads/main deleted file mode 100644 index ab80ca3ca6c..00000000000 --- a/tests/gitea-repositories-meta/user2/test_commit_revert.git/refs/heads/main +++ /dev/null @@ -1 +0,0 @@ -deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7 diff --git a/tests/integration/editor_test.go b/tests/integration/editor_test.go index 03f09ee1ea7..fa58b8df425 100644 --- a/tests/integration/editor_test.go +++ b/tests/integration/editor_test.go @@ -200,7 +200,7 @@ func TestWebGitCommitEmail(t *testing.T) { session := loginUser(t, user.Name) - makeReq := func(t *testing.T, link string, params map[string]string, expectedUserName, expectedEmail string) { + makeReq := func(t *testing.T, link string, params map[string]string, expectedUserName, expectedEmail string) *httptest.ResponseRecorder { lastCommit := getLastCommit(t) params["_csrf"] = GetUserCSRFToken(t, session) params["last_commit"] = lastCommit.ID.String() @@ -220,6 +220,7 @@ func TestWebGitCommitEmail(t *testing.T) { assert.EqualValues(t, expectedUserName, newCommit.Committer.Name) assert.EqualValues(t, expectedEmail, newCommit.Committer.Email) } + return resp } uploadFile := func(t *testing.T, name, content string) string { @@ -261,17 +262,18 @@ func TestWebGitCommitEmail(t *testing.T) { }, "", "") }) - testWebGit := func(t *testing.T, linkForKeepPrivate string, paramsForKeepPrivate map[string]string, linkForChosenEmail string, paramsForChosenEmail map[string]string) { + testWebGit := func(t *testing.T, linkForKeepPrivate string, paramsForKeepPrivate map[string]string, linkForChosenEmail string, paramsForChosenEmail map[string]string) (resp1, resp2 *httptest.ResponseRecorder) { t.Run("DefaultEmailKeepPrivate", func(t *testing.T) { defer tests.PrintCurrentTest(t)() paramsForKeepPrivate["commit_email"] = "" - makeReq(t, linkForKeepPrivate, paramsForKeepPrivate, "User Two", "user2@noreply.example.org") + resp1 = makeReq(t, linkForKeepPrivate, paramsForKeepPrivate, "User Two", "user2@noreply.example.org") }) t.Run("ChooseEmail", func(t *testing.T) { defer tests.PrintCurrentTest(t)() paramsForChosenEmail["commit_email"] = "user2@example.com" - makeReq(t, linkForChosenEmail, paramsForChosenEmail, "User Two", "user2@example.com") + resp2 = makeReq(t, linkForChosenEmail, paramsForChosenEmail, "User Two", "user2@example.com") }) + return resp1, resp2 } t.Run("Edit", func(t *testing.T) { @@ -324,10 +326,13 @@ index 0000000000..bbbbbbbbbb require.NoError(t, err) commit2, err := gitRepo.GetCommitByPath("patch-file-2.txt") require.NoError(t, err) - testWebGit(t, + resp1, _ := testWebGit(t, "/user2/repo1/_cherrypick/"+commit1.ID.String()+"/master", map[string]string{"revert": "true"}, "/user2/repo1/_cherrypick/"+commit2.ID.String()+"/master", map[string]string{"revert": "true"}, ) + + // By the way, test the "cherrypick" page: a successful revert redirects to the main branch + assert.EqualValues(t, "/user2/repo1/src/branch/master", resp1.Header().Get("Location")) }) }) } diff --git a/tests/integration/oauth_test.go b/tests/integration/oauth_test.go index d6f1ba33ec8..0766a9fc8ab 100644 --- a/tests/integration/oauth_test.go +++ b/tests/integration/oauth_test.go @@ -691,10 +691,6 @@ func TestOAuth_GrantScopesReadRepositoryFailOrganization(t *testing.T) { FullRepoName: "user2/commitsonpr", Private: false, }, - { - FullRepoName: "user2/test_commit_revert", - Private: true, - }, } assert.Equal(t, reposExpected, reposCaptured) diff --git a/tests/integration/repo_mergecommit_revert_test.go b/tests/integration/repo_mergecommit_revert_test.go deleted file mode 100644 index 103fb47e2b4..00000000000 --- a/tests/integration/repo_mergecommit_revert_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -package integration - -import ( - "net/http" - "testing" - - "code.gitea.io/gitea/tests" - - "github.com/stretchr/testify/assert" -) - -func TestRepoMergeCommitRevert(t *testing.T) { - defer tests.PrepareTestEnv(t)() - session := loginUser(t, "user2") - - req := NewRequest(t, "GET", "/user2/test_commit_revert/_cherrypick/deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7/main?ref=main&refType=branch&cherry-pick-type=revert") - resp := session.MakeRequest(t, req, http.StatusOK) - - htmlDoc := NewHTMLParser(t, resp.Body) - req = NewRequestWithValues(t, "POST", "/user2/test_commit_revert/_cherrypick/deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7/main", map[string]string{ - "_csrf": htmlDoc.GetCSRF(), - "last_commit": "deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7", - "page_has_posted": "true", - "revert": "true", - "commit_summary": "reverting test commit", - "commit_message": "test message", - "commit_choice": "direct", - "new_branch_name": "test-revert-branch-1", - }) - resp = session.MakeRequest(t, req, http.StatusSeeOther) - - // A successful revert redirects to the main branch - assert.EqualValues(t, "/user2/test_commit_revert/src/branch/main", resp.Header().Get("Location")) -}