Summary #
internal/bundle:- Extract
FetchFrom(ctx, baseURL)andfetchBytesso/loginand/bundle.jsrequests share HTTP transport setup and fail fast on non-200 HTTP status codes. - Add
(*Bundle).SecretValues()usingslices.Sorted(maps.Keys(secrets))to return deterministic, non-empty signing secrets and replace the manual map-key sorting loop incmd/gobuz/oauth_cmd.go. - Convert
internal/bundle/bundle_test.goto black-boxpackage bundle_test, replacing direct&Bundle{content: ...}struct literal construction, private regex assertions, and conditional test branches with linear behavioral tests againsthttptest.NewServer.
- Extract
internal/oauth:- Simplify
parseQueryParamswithcmp.Orand deduplicate HTML response writing in the local OAuth callback handler. - Convert
internal/oauth/oauth_test.goto black-boxpackage oauth_test, exercising redirect query parameter and authorization code variants behaviorally throughoauth.Login.
- Simplify
Verification #
go test -count=1 ./...go vet ./...