0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-06-02 10:39:50 +02:00
This commit is contained in:
yp05327 2024-05-15 23:52:16 +00:00
parent c6edde19ff
commit 4ed9e41766

View file

@ -273,7 +273,7 @@ func TestRecentlyPushedNewBranches(t *testing.T) {
checkRecentlyPushedNewBranches(t, user1Session, "user12/repo10", []string{"private_org35/org35_fork_repo10:new-commit"})
// user2 push a branch in private_org35
testCreateBranch(t, user2Session, orgPrivateForkRepo.OwnerName, orgPrivateForkRepo.Name, "branch/new-commit", "user-no-permission", http.StatusSeeOther)
testCreateBranch(t, user2Session, orgPrivateForkRepo.OwnerName, orgPrivateForkRepo.Name, "branch/new-commit", "user-read-permission", http.StatusSeeOther)
// convert write permission to read permission for code unit
token := getTokenForLoggedInUser(t, user1Session, auth_model.AccessTokenScopeWriteOrganization)
req := NewRequestWithJSON(t, "PATCH", fmt.Sprintf("/api/v1/teams/%d", 24), &api.EditTeamOption{
@ -283,7 +283,7 @@ func TestRecentlyPushedNewBranches(t *testing.T) {
MakeRequest(t, req, http.StatusOK)
teamUnit := unittest.AssertExistsAndLoadBean(t, &org_model.TeamUnit{TeamID: 24, Type: unit.TypeCode})
assert.Equal(t, perm.AccessModeRead, teamUnit.AccessMode)
// user2 should not see the branch
checkRecentlyPushedNewBranches(t, user2Session, "user12/repo10", []string{})
// user2 can see the branch as it is created by user2
checkRecentlyPushedNewBranches(t, user2Session, "user12/repo10", []string{"private_org35/org35_fork_repo10:user-read-permission"})
})
}