mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-05-01 18:40:03 -05:00
Add t.Helper annotations to Go test helpers (#253)
* Initial plan * test: mark helper functions with t.Helper Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func gcDataTestSuite(ctx context.Context, property *dbgen.Property, deleter func(p *dbgen.Property) error, t *testing.T) {
|
||||
t.Helper()
|
||||
|
||||
const requests = 1000
|
||||
tnow := time.Now()
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ func randomUUID() *pgtype.UUID {
|
||||
}
|
||||
|
||||
func puzzleSuiteWithBackfillWait(t *testing.T, ctx context.Context, sitekey, domain string, waiter func()) {
|
||||
t.Helper()
|
||||
|
||||
resp, err := puzzleSuite(ctx, sitekey, domain)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -703,6 +703,8 @@ func TestVerifyMaintenanceMode(t *testing.T) {
|
||||
}
|
||||
|
||||
func verifyTestPropertySuite(t *testing.T, verifySitekey string, expectedCode puzzle.VerifyError) {
|
||||
t.Helper()
|
||||
|
||||
ctx := t.Context()
|
||||
|
||||
puzzleStr, solutionsStr, err := solutionsSuite(ctx, db.TestPropertySitekey, "localhost")
|
||||
|
||||
@@ -29,6 +29,8 @@ func licenseTestConfig(licenseKey string) common.ConfigStore {
|
||||
}
|
||||
|
||||
func createValidLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) []byte {
|
||||
t.Helper()
|
||||
|
||||
lm := &license.LicenseMessage{
|
||||
KeyID: uint32(keyID),
|
||||
UserID: "test-user-id",
|
||||
@@ -57,6 +59,8 @@ func createValidLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privK
|
||||
}
|
||||
|
||||
func createExpiredLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) []byte {
|
||||
t.Helper()
|
||||
|
||||
lm := &license.LicenseMessage{
|
||||
KeyID: uint32(keyID),
|
||||
UserID: "test-user-id",
|
||||
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
)
|
||||
|
||||
func setupSessionSuite(ctx context.Context, manager *session.Manager, t *testing.T) (*session.Session, *http.Cookie) {
|
||||
t.Helper()
|
||||
|
||||
req := httptest.NewRequest("GET", "/settings", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ func TestPuzzleUnmarshalFail(t *testing.T) {
|
||||
}
|
||||
|
||||
func checkPuzzles(oldPuzzle, newPuzzle *ComputePuzzle, t *testing.T) {
|
||||
t.Helper()
|
||||
|
||||
if !bytes.Equal(oldPuzzle.propertyID[:], newPuzzle.propertyID[:]) {
|
||||
t.Errorf("PropertyID does not match")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user