summaryrefslogtreecommitdiffstats
path: root/models/org_test.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-03-01 01:47:30 +0100
committerGitHub <noreply@github.com>2021-03-01 01:47:30 +0100
commita4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8 (patch)
tree92edf61ff2447e067a676832844a129050b4ec0f /models/org_test.go
parente0900310c4354311362ef69d15c302c215eaa2a2 (diff)
downloadgitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.tar.gz
gitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.zip
Repository transfer has to be confirmed, if user can not create repo for new owner (#14792)
* make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination * if new pending transfer ocured, create UI & Mail notifications
Diffstat (limited to 'models/org_test.go')
-rw-r--r--models/org_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/models/org_test.go b/models/org_test.go
index 79f8b060e7..45268f0f23 100644
--- a/models/org_test.go
+++ b/models/org_test.go
@@ -635,3 +635,21 @@ func TestHasOrgVisibleTypePrivate(t *testing.T) {
assert.Equal(t, test2, false) // user not a part of org
assert.Equal(t, test3, false) // logged out user
}
+
+func TestGetUsersWhoCanCreateOrgRepo(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+
+ users, err := GetUsersWhoCanCreateOrgRepo(3)
+ assert.NoError(t, err)
+ assert.Len(t, users, 2)
+ var ids []int64
+ for i := range users {
+ ids = append(ids, users[i].ID)
+ }
+ assert.ElementsMatch(t, ids, []int64{2, 28})
+
+ users, err = GetUsersWhoCanCreateOrgRepo(7)
+ assert.NoError(t, err)
+ assert.Len(t, users, 1)
+ assert.EqualValues(t, 5, users[0].ID)
+}