// Package gitea — export_test.go exposes test helpers to test files in this // package. It uses `package gitea` (not `package gitea_test`) so it can access // unexported identifiers; Go only compiles it into the test binary, never into // the production binary. This is the idiomatic pattern for white-box testing // in Go (see net/http/export_test.go in the stdlib for the same approach). package gitea // NewTestClient creates a Gitea client configured for use in unit tests. // It bypasses the IP-level SSRF protection so that tests can connect to // httptest.Server instances (which listen on 127.0.0.1). // // Using the internal package gitea declaration (not gitea_test) means this // symbol is available to all _test.go files in this package. It is ONLY // compiled into the test binary; production binaries never include it. // Production code must use NewClient, which enables the safe dialer. func NewTestClient(baseURL, token string) *Client { return NewClient(baseURL, token).WithUnsafeDialer() }