I built a local emulator for Gmail, Jira and Slack so my tests stop needing OAuth
| Last week I asked here how people test against third-party APIs they don't control. Most answers came down to the same thing: fixtures rot, and if you're disciplined you run something against the real API at night. I've been working on a small server for that problem and wanted to show it. It's a local server that answers the way Slack, Gmail, Google Drive, GitHub, Jira, Notion and S3 do. You point the vendor's own SDK at localhost and it gets the same response shapes, cursors, auth errors and per-user permissions the real service sends, out of one SQLite file you control. No account with the vendor, no OAuth app, no token in CI, no network. Why not a mock: a mock I write returns what I already think the API returns, so it can't disagree with me. This was built by measuring the real responses and matching them, and when it's wrong the fix starts with a test that fails against the real API. The server is Python (FastAPI) over one SQLite file, but it's all plain HTTP: anything that lets you set a base URL points at it unchanged. The drift part, since that was most of the thread. Things that were harder than I expected:
Permissions are per user. Every person in the corpus has a token, and someone's private channel never shows up in another caller's listing, search included. Against the sample corpus https://github.com/brekkylab/backlot If you already run something nightly against a real API, what would this need before you'd trust it next to that? And if the API you need isn't in there, which one? Happy to answer anything. [link] [comments] |