fix: CreateDeclarativeRepo should allow merging PRs when PRs are enabled

This commit is contained in:
BtbN 2025-08-10 01:34:58 +02:00 committed by BtbN
commit fa5011b988

View file

@ -495,6 +495,25 @@ func CreateDeclarativeRepo(t *testing.T, owner *user_model.User, name string, en
}
if enabledUnits != nil {
opts.EnabledUnits = optional.Some(enabledUnits)
for _, unitType := range enabledUnits {
if unitType == unit_model.TypePullRequests {
opts.UnitConfig = optional.Some(map[unit_model.Type]convert.Conversion{
unit_model.TypePullRequests: &repo_model.PullRequestsConfig{
AllowMerge: true,
AllowRebase: true,
AllowRebaseMerge: true,
AllowSquash: true,
AllowFastForwardOnly: true,
AllowManualMerge: true,
AllowRebaseUpdate: true,
DefaultMergeStyle: repo_model.MergeStyleMerge,
DefaultUpdateStyle: repo_model.UpdateStyleMerge,
},
})
break
}
}
}
if disabledUnits != nil {
opts.DisabledUnits = optional.Some(disabledUnits)