-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/system_webhooks_menu
- Loading branch information
Showing
101 changed files
with
1,804 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
open_collective: gitea | ||
custom: https://www.bountysource.com/teams/gitea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package integrations | ||
|
||
import ( | ||
"net/http" | ||
"strconv" | ||
"testing" | ||
|
||
"code.gitea.io/gitea/models" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAdminViewUsers(t *testing.T) { | ||
prepareTestEnv(t) | ||
|
||
session := loginUser(t, "user1") | ||
req := NewRequest(t, "GET", "/admin/users") | ||
session.MakeRequest(t, req, http.StatusOK) | ||
|
||
session = loginUser(t, "user2") | ||
req = NewRequest(t, "GET", "/admin/users") | ||
session.MakeRequest(t, req, http.StatusForbidden) | ||
} | ||
|
||
func TestAdminViewUser(t *testing.T) { | ||
prepareTestEnv(t) | ||
|
||
session := loginUser(t, "user1") | ||
req := NewRequest(t, "GET", "/admin/users/1") | ||
session.MakeRequest(t, req, http.StatusOK) | ||
|
||
session = loginUser(t, "user2") | ||
req = NewRequest(t, "GET", "/admin/users/1") | ||
session.MakeRequest(t, req, http.StatusForbidden) | ||
} | ||
|
||
func TestAdminEditUser(t *testing.T) { | ||
prepareTestEnv(t) | ||
|
||
testSuccessfullEdit(t, models.User{ID: 2, Name: "newusername", LoginName: "otherlogin", Email: "new@e-mail.gitea"}) | ||
} | ||
|
||
func testSuccessfullEdit(t *testing.T, formData models.User) { | ||
makeRequest(t, formData, http.StatusFound) | ||
} | ||
|
||
func makeRequest(t *testing.T, formData models.User, headerCode int) { | ||
session := loginUser(t, "user1") | ||
csrf := GetCSRF(t, session, "/admin/users/"+strconv.Itoa(int(formData.ID))) | ||
req := NewRequestWithValues(t, "POST", "/admin/users/"+strconv.Itoa(int(formData.ID)), map[string]string{ | ||
"_csrf": csrf, | ||
"user_name": formData.Name, | ||
"login_name": formData.LoginName, | ||
"login_type": "0-0", | ||
"email": formData.Email, | ||
}) | ||
|
||
session.MakeRequest(t, req, headerCode) | ||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: formData.ID}).(*models.User) | ||
assert.Equal(t, formData.Name, user.Name) | ||
assert.Equal(t, formData.LoginName, user.LoginName) | ||
assert.Equal(t, formData.Email, user.Email) | ||
} | ||
|
||
func TestAdminDeleteUser(t *testing.T) { | ||
defer prepareTestEnv(t)() | ||
|
||
session := loginUser(t, "user1") | ||
|
||
csrf := GetCSRF(t, session, "/admin/users/8") | ||
req := NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{ | ||
"_csrf": csrf, | ||
}) | ||
session.MakeRequest(t, req, http.StatusOK) | ||
|
||
assertUserDeleted(t, 8) | ||
models.CheckConsistencyFor(t, &models.User{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true |
1 change: 1 addition & 0 deletions
1
integrations/gitea-repositories-meta/user2/repo2.git/description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
15 changes: 15 additions & 0 deletions
15
integrations/gitea-repositories-meta/user2/repo2.git/hooks/applypatch-msg.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script to check the commit log message taken by | ||
# applypatch from an e-mail message. | ||
# | ||
# The hook should exit with non-zero status after issuing an | ||
# appropriate message if it wants to stop the commit. The hook is | ||
# allowed to edit the commit message file. | ||
# | ||
# To enable this hook, rename this file to "applypatch-msg". | ||
|
||
. git-sh-setup | ||
commitmsg="$(git rev-parse --git-path hooks/commit-msg)" | ||
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} | ||
: |
24 changes: 24 additions & 0 deletions
24
integrations/gitea-repositories-meta/user2/repo2.git/hooks/commit-msg.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script to check the commit log message. | ||
# Called by "git commit" with one argument, the name of the file | ||
# that has the commit message. The hook should exit with non-zero | ||
# status after issuing an appropriate message if it wants to stop the | ||
# commit. The hook is allowed to edit the commit message file. | ||
# | ||
# To enable this hook, rename this file to "commit-msg". | ||
|
||
# Uncomment the below to add a Signed-off-by line to the message. | ||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg | ||
# hook is more suited to it. | ||
# | ||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') | ||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" | ||
|
||
# This example catches duplicate Signed-off-by lines. | ||
|
||
test "" = "$(grep '^Signed-off-by: ' "$1" | | ||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { | ||
echo >&2 Duplicate Signed-off-by lines. | ||
exit 1 | ||
} |
8 changes: 8 additions & 0 deletions
8
integrations/gitea-repositories-meta/user2/repo2.git/hooks/post-update.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script to prepare a packed repository for use over | ||
# dumb transports. | ||
# | ||
# To enable this hook, rename this file to "post-update". | ||
|
||
exec git update-server-info |
Oops, something went wrong.