[TESTS] Move CreateDeclarativeRepo to more accessible location

- This allows `CreateDeclarativeRepo` to be used by other testing
packages such as E2EE testing.
- Removes unused function in `services/webhook/sourcehut/builds_test.go`.
This commit is contained in:
Gusted 2024-08-25 02:47:35 +02:00
parent 78e4736db6
commit f78e397dd6
No known key found for this signature in database
GPG key ID: FD821B732837125F
32 changed files with 196 additions and 258 deletions

View file

@ -292,7 +292,7 @@ func prepareQuotaEnv(t *testing.T, username string) *quotaEnv {
env.cleanups = append(env.cleanups, userCleanup)
// Create a repository
repo, _, repoCleanup := CreateDeclarativeRepoWithOptions(t, env.User.User, DeclarativeRepoOptions{})
repo, _, repoCleanup := tests.CreateDeclarativeRepoWithOptions(t, env.User.User, tests.DeclarativeRepoOptions{})
env.Repo = repo
env.cleanups = append(env.cleanups, repoCleanup)
@ -487,7 +487,7 @@ func testAPIQuotaEnforcement(t *testing.T) {
defer tests.PrintCurrentTest(t)()
// Create a template repository
template, _, cleanup := CreateDeclarativeRepoWithOptions(t, env.User.User, DeclarativeRepoOptions{
template, _, cleanup := tests.CreateDeclarativeRepoWithOptions(t, env.User.User, tests.DeclarativeRepoOptions{
IsTemplate: optional.Some(true),
})
defer cleanup()
@ -524,7 +524,7 @@ func testAPIQuotaEnforcement(t *testing.T) {
t.Run("#/repos/{username}/{reponame}", func(t *testing.T) {
// Lets create a new repo to play with.
repo, _, repoCleanup := CreateDeclarativeRepoWithOptions(t, env.User.User, DeclarativeRepoOptions{})
repo, _, repoCleanup := tests.CreateDeclarativeRepoWithOptions(t, env.User.User, tests.DeclarativeRepoOptions{})
defer repoCleanup()
// Drop the quota to 0
@ -1209,7 +1209,7 @@ func testAPIQuotaEnforcement(t *testing.T) {
defer tests.PrintCurrentTest(t)()
// Create a repository to transfer
repo, _, cleanup := CreateDeclarativeRepoWithOptions(t, env.User.User, DeclarativeRepoOptions{})
repo, _, cleanup := tests.CreateDeclarativeRepoWithOptions(t, env.User.User, tests.DeclarativeRepoOptions{})
defer cleanup()
// Initiate repo transfer
@ -1244,7 +1244,7 @@ func testAPIQuotaEnforcement(t *testing.T) {
defer env.SetRuleLimit(t, "deny-all", -1)()
// Create a repository to transfer
repo, _, cleanup := CreateDeclarativeRepoWithOptions(t, env.User.User, DeclarativeRepoOptions{})
repo, _, cleanup := tests.CreateDeclarativeRepoWithOptions(t, env.User.User, tests.DeclarativeRepoOptions{})
defer cleanup()
// Initiate repo transfer