Skip to content

Commit 693a225

Browse files
committed
fix test
1 parent 2db0046 commit 693a225

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

tests/integration/git_general_test.go

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -365,27 +365,23 @@ func doBranchProtectPRMerge(baseCtx *APITestContext, dstPath string) func(t *tes
365365
ctx := NewAPITestContext(t, baseCtx.Username, baseCtx.Reponame, auth_model.AccessTokenScopeWriteRepository)
366366

367367
// Protect branch without any whitelisting
368-
t.Run("ProtectBranchNoWhitelist", func(t *testing.T) {
369-
doProtectBranch(ctx, "protected", "", "", "", "")
370-
})
368+
t.Run("ProtectBranchNoWhitelist", doProtectBranch(ctx, "protected", "", "", "", ""))
371369

372370
// Try to push without permissions, which should fail
373371
t.Run("TryPushWithoutPermissions", func(t *testing.T) {
374372
_, err := generateCommitWithNewData(testFileSizeSmall, dstPath, "[email protected]", "User Two", "branch-data-file-")
375373
assert.NoError(t, err)
376-
doGitPushTestRepositoryFail(dstPath, "origin", "protected")
374+
doGitPushTestRepositoryFail(dstPath, "origin", "protected")(t)
377375
})
378376

379377
// Set up permissions for normal push but not force push
380-
t.Run("SetupNormalPushPermissions", func(t *testing.T) {
381-
doProtectBranch(ctx, "protected", baseCtx.Username, "", "", "")
382-
})
378+
t.Run("SetupNormalPushPermissions", doProtectBranch(ctx, "protected", baseCtx.Username, "", "", ""))
383379

384380
// Normal push should work
385381
t.Run("NormalPushWithPermissions", func(t *testing.T) {
386382
_, err := generateCommitWithNewData(testFileSizeSmall, dstPath, "[email protected]", "User Two", "branch-data-file-")
387383
assert.NoError(t, err)
388-
doGitPushTestRepository(dstPath, "origin", "protected")
384+
doGitPushTestRepository(dstPath, "origin", "protected")(t)
389385
})
390386

391387
// Try to force push without force push permissions, which should fail
@@ -395,28 +391,20 @@ func doBranchProtectPRMerge(baseCtx *APITestContext, dstPath string) func(t *tes
395391
_, err := generateCommitWithNewData(testFileSizeSmall, dstPath, "[email protected]", "User Two", "branch-data-file-new")
396392
assert.NoError(t, err)
397393
})
398-
doGitPushTestRepositoryFail(dstPath, "-f", "origin", "protected")
394+
doGitPushTestRepositoryFail(dstPath, "-f", "origin", "protected")(t)
399395
})
400396

401397
// Set up permissions for force push but not normal push
402-
t.Run("SetupForcePushPermissions", func(t *testing.T) {
403-
doProtectBranch(ctx, "protected", "", baseCtx.Username, "", "")
404-
})
398+
t.Run("SetupForcePushPermissions", doProtectBranch(ctx, "protected", "", baseCtx.Username, "", ""))
405399

406400
// Try to force push without normal push permissions, which should fail
407-
t.Run("ForcePushWithoutNormalPermissions", func(t *testing.T) {
408-
doGitPushTestRepositoryFail(dstPath, "-f", "origin", "protected")
409-
})
401+
t.Run("ForcePushWithoutNormalPermissions", doGitPushTestRepositoryFail(dstPath, "-f", "origin", "protected"))
410402

411403
// Set up permissions for normal and force push (both are required to force push)
412-
t.Run("SetupNormalAndForcePushPermissions", func(t *testing.T) {
413-
doProtectBranch(ctx, "protected", baseCtx.Username, baseCtx.Username, "", "")
414-
})
404+
t.Run("SetupNormalAndForcePushPermissions", doProtectBranch(ctx, "protected", baseCtx.Username, baseCtx.Username, "", ""))
415405

416406
// Force push should now work
417-
t.Run("ForcePushWithPermissions", func(t *testing.T) {
418-
doGitPushTestRepository(dstPath, "-f", "origin", "protected")
419-
})
407+
t.Run("ForcePushWithPermissions", doGitPushTestRepository(dstPath, "-f", "origin", "protected"))
420408

421409
t.Run("ProtectProtectedBranchNoWhitelist", doProtectBranch(ctx, "protected", "", "", "", ""))
422410
t.Run("PushToUnprotectedBranch", doGitPushTestRepository(dstPath, "origin", "protected:unprotected"))

0 commit comments

Comments
 (0)