Skip to content

Commit dbdd027

Browse files
update an org test to add a team to a repo group
1 parent bffee8b commit dbdd027

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/integration/org_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import (
1111

1212
auth_model "code.gitea.io/gitea/models/auth"
1313
"code.gitea.io/gitea/models/db"
14+
group_model "code.gitea.io/gitea/models/group"
1415
"code.gitea.io/gitea/models/organization"
1516
"code.gitea.io/gitea/models/perm"
1617
"code.gitea.io/gitea/models/unit"
1718
"code.gitea.io/gitea/models/unittest"
1819
user_model "code.gitea.io/gitea/models/user"
1920
api "code.gitea.io/gitea/modules/structs"
21+
group_service "code.gitea.io/gitea/services/group"
2022
"code.gitea.io/gitea/tests"
2123

2224
"github.com/stretchr/testify/assert"
@@ -202,6 +204,12 @@ func TestOrgRestrictedUser(t *testing.T) {
202204
AddTokenAuth(token)
203205
_ = adminSession.MakeRequest(t, req, http.StatusNoContent)
204206

207+
// we also need to give this new team access to the repo's group
208+
g := unittest.AssertExistsAndLoadBean[*group_model.Group](t, &group_model.Group{
209+
ID: int64(repoGroup),
210+
})
211+
assert.NoError(t, group_service.AddTeamToGroup(t.Context(), g, apiTeam.Name))
212+
205213
// Now we need to check if the restrictedUser can access the repo
206214
req = NewRequest(t, "GET", "/"+orgName)
207215
restrictedSession.MakeRequest(t, req, http.StatusOK)

0 commit comments

Comments
 (0)