remove unnecessary tests

pull/33445/head
wxiaoguang 16 hours ago
parent 6da5fc6ef3
commit d8b90aa07a
  1. 13
      models/fixtures/repository.yml
  2. 2
      models/fixtures/user.yml
  3. 1
      tests/gitea-repositories-meta/user2/test_commit_revert.git/HEAD
  4. 8
      tests/gitea-repositories-meta/user2/test_commit_revert.git/config
  5. BIN
      tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.idx
  6. BIN
      tests/gitea-repositories-meta/user2/test_commit_revert.git/objects/pack/pack-91200c8e6707636a6cc3e0d8101fba08b19dcb91.pack
  7. 3
      tests/gitea-repositories-meta/user2/test_commit_revert.git/packed-refs
  8. 1
      tests/gitea-repositories-meta/user2/test_commit_revert.git/refs/heads/main
  9. 15
      tests/integration/editor_test.go
  10. 4
      tests/integration/oauth_test.go
  11. 37
      tests/integration/repo_mergecommit_revert_test.go

@ -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

@ -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

@ -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

@ -1,3 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
46aa6ab2c881ae90e15d9ccfc947d1625c892ce5 refs/heads/develop
deebcbc752e540bab4ce3ee713d3fc8fdc35b2f7 refs/heads/main

@ -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"))
})
})
}

@ -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)

@ -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"))
}
Loading…
Cancel
Save