mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-08 23:57:39 +00:00
chore: QoL improvements to tests (#7917)
- Use mock helper functions, instead of home-brew solutions. - Disable cron jobs that are not important to be run during integration tests and might even interfere. - Avoid sleeping unnecessary, if there's some requirement then sleep or retry until that requirement is met. - Avoid trying to deliver webhooks that will always result in a failure. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7917 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
112ba66637
commit
fa2a135f68
44 changed files with 155 additions and 264 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/modules/git"
|
||||
"forgejo.org/modules/setting"
|
||||
"forgejo.org/modules/test"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -36,7 +37,7 @@ func TestForkRepository(t *testing.T) {
|
|||
assert.False(t, repo_model.IsErrReachLimitOfRepo(err))
|
||||
|
||||
// change AllowForkWithoutMaximumLimit to false for the test
|
||||
setting.Repository.AllowForkWithoutMaximumLimit = false
|
||||
defer test.MockVariableValue(&setting.Repository.AllowForkWithoutMaximumLimit, false)()
|
||||
// user has reached maximum limit of repositories
|
||||
user.MaxRepoCreation = 0
|
||||
fork2, err := ForkRepositoryAndUpdates(git.DefaultContext, user, user, ForkRepoOptions{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue