
Ask HN: How would you implement a test-mode for an API? - ezekg
Looking to implement something similar to what Stripe has for their API (live&#x2F;test API keys), but haven&#x27;t decided on a solid direction to take yet. Curious as to how others would approach this type of feature.<p><pre><code>  * Would you use a scope via an attribute on the model?
  * Would you use a separate Postgres schema for test-mode requests?
  * Maybe even a separate database?</code></pre>
======
whatnotests
Make it a completely separate stack.

    
    
        * Authentication / API Keys
        * Servers
        * Schema
        * etc
    

Also, don't make the mistake some others do, by making it _your_ testing
environment as well. Instead, consider this environment a "Sandbox
Environment" which has the same SLA as your production environment.

------
amacalac
* I would use an ACL on test keys * I'd use the same schema * I'd use a separate database.

You want test mode to 100% replicate production mode, but you never want test
data to contaminate your production data

~~~
ezekg
Great point about not contaminating production data.

And just to clarify, ACL = access control list?

