Repository navigation
Add live tests against the real SendGrid API and verified APIs - #100
Merged
Merged
Conversation
… mise The test workflow already uses mise-action, so align the lint workflow and local commands with it. - Port Makefile targets to mise.toml tasks and remove Makefile and .tool-versions - Switch the lint workflow from setup-go + make to mise-action + mise run lint - Ignore mise.local.toml / mise.*.local.toml, which hold secrets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The real API response includes active (0/1), but the struct had no field for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add GetPreBuiltDesign / DuplicatePreBuiltDesign - Verified against the real API: the duplicated design is retrievable and returns 404 after deletion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add GetBounceClassifications / GetBounceClassificationsByDomain - Verified that real API responses match the structs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elds - Add EmailDNSRecordsToCoworker / AssociateAuthenticatedDomainWithSubuserMultiple / GetAllAuthenticatedDomainsAssociatedWithSubuser - Add last_validation_attempt_at to OutputGetAuthenticatedDomain, as returned by the real API - URL-encode username, since subuser names containing & or # broke the query string Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add fields found in real API responses: is_reseller_customer / is_hard_limit / authy_id / multifactor_phone / type / userid - Update APIs (email, password, username, profile) were not run against the real API because they cannot be undone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Verified create, re-fetch after update, and 404 after delete against the real API (List / Segment / Campaign)
- GET /senders returns a bare array, so GetLegacySenders now returns []*LegacySender
- verified is returned as a {status, reason} object, not a bool, so add LegacySenderVerified
- Add recipient_count to recipient list responses
- Sender create/update/resend verification and Campaign send/schedule were not run because they send email
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /marketing/senders returns a bare array, so GetMarketingSenders now returns []*MarketingSender
- verified is returned as a {status, reason} object, so add MarketingSenderVerified
- Create/update/resend verification were not run against the real API because they send email
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Verified that real API responses match the structs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Verified that real API responses for the read APIs match the structs - Adding IPs, creating/updating/deleting pools, and assigning subusers were not run because they affect delivery and billing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Verified that real API responses match the structs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit tests with mocked responses cannot catch differences from the real API (undefined fields, type mismatches, array vs. object). - Isolated by the live build tag from regular tests and CI; run with mise run test-live - Abort all tests unless SENDGRID_LIVE_USERNAME matches the API key's account - Compare responses with the structs and list every undefined field as a JSON path - Verify updates by re-fetching and deletions by confirming the resource is gone - Treat accounts not matching SENDGRID_LIVE_PRIVATE_USERNAME as shared and do not log response bodies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kenzo0107
force-pushed
the
add-live-api-tests
branch
from
October 7, 2026 00:30
7779667 to
97440d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds live tests that call the real SendGrid API, and includes only the new or changed APIs that could be verified against it.
Unit tests with mocked responses cannot catch differences from the real API (undefined fields, type mismatches, array vs. object). The live tests exposed several such differences, which are fixed here.
Live tests (
mise run test-live)livebuild tag, so they never run withmise run testor in CI.SENDGRID_LIVE_USERNAMEmatches the API key's account.SENDGRID_LIVE_PRIVATE_USERNAMEare treated as shared, and response bodies are never logged for them.Differences found against the real API
GetLegacySenders/GetMarketingSenders[]*LegacySender/[]*MarketingSenderverified{status, reason}object, so it is now*LegacySenderVerified/*MarketingSenderVerifiedVersionactiveOutputGetAuthenticatedDomainlast_validation_attempt_atrecipient_countis_reseller_customer/is_hard_limit/authy_id/multifactor_phone/type/useridGetAllAuthenticatedDomainsAssociatedWithSubuserusernameis now URL-encodedNew APIs
Methods that send email, incur charges, or cannot be undone were not run against the real API. These include Sender creation and verification emails, Campaign send/schedule, IP and pool changes, and User updates.
Task runner migration
Migrates the Makefile and
.tool-versionsto mise. The test workflow already used mise-action, so the lint workflow now does too.Test plan
mise run test(unit tests)golangci-lint run --build-tags live --tests ./...mise run test-liveon a private test account (0 failures)mise run test-liveon a shared account (18 passed, 0 failed)🤖 Generated with Claude Code