mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-03 21:12:09 +02:00
update an org test to add a team to a repo group
This commit is contained in:
parent
e27fe6586f
commit
cdf24a58a2
@ -11,12 +11,14 @@ import (
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
group_model "code.gitea.io/gitea/models/group"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
group_service "code.gitea.io/gitea/services/group"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -201,6 +203,12 @@ func testOrgRestrictedUser(t *testing.T) {
|
||||
AddTokenAuth(token)
|
||||
_ = adminSession.MakeRequest(t, req, http.StatusNoContent)
|
||||
|
||||
// we also need to give this new team access to the repo's group
|
||||
g := unittest.AssertExistsAndLoadBean[*group_model.Group](t, &group_model.Group{
|
||||
ID: int64(repoGroup),
|
||||
})
|
||||
assert.NoError(t, group_service.AddTeamToGroup(t.Context(), g, apiTeam.Name))
|
||||
|
||||
// Now we need to check if the restrictedUser can access the repo
|
||||
req = NewRequest(t, "GET", "/"+orgName)
|
||||
restrictedSession.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user