9a5720e8ad
Branch Policy Check / Verify merge target (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
PR RC Release / Build RC Release (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Full namespace migration: update the Go module path and all import statements from git.mokoconsulting.tech to code.mokoconsulting.tech. Also updates all URL references in templates, workflows, configs, tests, and documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
33 lines
918 B
Go
33 lines
918 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package repo
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/unit"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/unittest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDefaultTargetBranchSelection(t *testing.T) {
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
|
|
|
ctx := t.Context()
|
|
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 1})
|
|
|
|
assert.Equal(t, repo.DefaultBranch, repo.GetPullRequestTargetBranch(ctx))
|
|
|
|
repo.Units = nil
|
|
prUnit, err := repo.GetUnit(ctx, unit.TypePullRequests)
|
|
assert.NoError(t, err)
|
|
prConfig := prUnit.PullRequestsConfig()
|
|
prConfig.DefaultTargetBranch = "branch2"
|
|
prUnit.Config = prConfig
|
|
assert.NoError(t, UpdateRepoUnitConfig(ctx, prUnit))
|
|
repo.Units = nil
|
|
assert.Equal(t, "branch2", repo.GetPullRequestTargetBranch(ctx))
|
|
}
|