diff --git a/tests/integration/git_test.go b/tests/integration/git_test.go index 5ee5dedbd4..ff0124abf7 100644 --- a/tests/integration/git_test.go +++ b/tests/integration/git_test.go @@ -43,7 +43,7 @@ func TestGit(t *testing.T) { func testGit(t *testing.T, u *url.URL) { username := "user2" - baseAPITestContext := NewAPITestContext(t, username, "repo1", "repo", "write_public_key") + baseAPITestContext := NewAPITestContext(t, username, "repo1", "repo", "write_public_key", "delete_repo") u.Path = baseAPITestContext.GitPath() diff --git a/tests/integration/ssh_key_test.go b/tests/integration/ssh_key_test.go index 7c1d968589..11f8e437e3 100644 --- a/tests/integration/ssh_key_test.go +++ b/tests/integration/ssh_key_test.go @@ -49,6 +49,8 @@ func TestPushDeployKeyOnEmptyRepo(t *testing.T) { func testPushDeployKeyOnEmptyRepo(t *testing.T, u *url.URL) { // OK login ctx := NewAPITestContext(t, "user2", "deploy-key-empty-repo-1", "repo") + ctxWithDeleteRepo := NewAPITestContext(t, "user2", "deploy-key-empty-repo-1", "repo", "delete_repo") + keyname := fmt.Sprintf("%s-push", ctx.Reponame) u.Path = ctx.GitPath() @@ -73,7 +75,7 @@ func testPushDeployKeyOnEmptyRepo(t *testing.T, u *url.URL) { t.Run("CheckIsNotEmpty", doCheckRepositoryEmptyStatus(ctx, false)) - t.Run("DeleteRepository", doAPIDeleteRepository(ctx)) + t.Run("DeleteRepository", doAPIDeleteRepository(ctxWithDeleteRepo)) }) } @@ -91,9 +93,12 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) { // OK login ctx := NewAPITestContext(t, username, reponame, "repo", "admin_public_key") + ctxWithDeleteRepo := NewAPITestContext(t, username, reponame, "repo", "admin_public_key", "delete_repo") otherCtx := ctx otherCtx.Reponame = "ssh-key-test-repo-2" + otherCtxWithDeleteRepo := ctxWithDeleteRepo + otherCtxWithDeleteRepo.Reponame = otherCtx.Reponame failCtx := ctx failCtx.ExpectedCode = http.StatusUnprocessableEntity @@ -171,9 +176,9 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) { t.Run("PushToOther", doGitPushTestRepository(dstOtherPath, "origin", "master")) - t.Run("DeleteOtherRepository", doAPIDeleteRepository(otherCtx)) + t.Run("DeleteOtherRepository", doAPIDeleteRepository(otherCtxWithDeleteRepo)) - t.Run("RecreateRepository", doAPICreateRepository(ctx, false)) + t.Run("RecreateRepository", doAPICreateRepository(ctxWithDeleteRepo, false)) t.Run("CreateUserKey", doAPICreateUserKey(ctx, keyname, keyFile, func(t *testing.T, publicKey api.PublicKey) { userKeyPublicKeyID = publicKey.ID