mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 22:59:29 +01:00
chore(cleanup): remove unused TestCreateFile
Since CreateDeclarativeRepoWithOptions it is more convenient to create a file by providing arguments.
This commit is contained in:
parent
d5426b0626
commit
c5c1d593ad
1 changed files with 0 additions and 29 deletions
|
@ -27,35 +27,6 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateFile(t *testing.T) {
|
|
||||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
|
||||||
session := loginUser(t, "user2")
|
|
||||||
testCreateFile(t, session, "user2", "repo1", "master", "test.txt", "Content")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func testCreateFile(t *testing.T, session *TestSession, user, repo, branch, filePath, content string) *httptest.ResponseRecorder {
|
|
||||||
// Request editor page
|
|
||||||
newURL := fmt.Sprintf("/%s/%s/_new/%s/", user, repo, branch)
|
|
||||||
req := NewRequest(t, "GET", newURL)
|
|
||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
|
||||||
|
|
||||||
doc := NewHTMLParser(t, resp.Body)
|
|
||||||
lastCommit := doc.GetInputValueByName("last_commit")
|
|
||||||
assert.NotEmpty(t, lastCommit)
|
|
||||||
|
|
||||||
// Save new file to master branch
|
|
||||||
req = NewRequestWithValues(t, "POST", newURL, map[string]string{
|
|
||||||
"_csrf": doc.GetCSRF(),
|
|
||||||
"last_commit": lastCommit,
|
|
||||||
"tree_path": filePath,
|
|
||||||
"content": content,
|
|
||||||
"commit_choice": "direct",
|
|
||||||
"commit_mail_id": "3",
|
|
||||||
})
|
|
||||||
return session.MakeRequest(t, req, http.StatusSeeOther)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateFileOnProtectedBranch(t *testing.T) {
|
func TestCreateFileOnProtectedBranch(t *testing.T) {
|
||||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
|
|
Loading…
Reference in a new issue