I maintain a python library for some of the HubSpot APIs, and was recently reworking some of my unit tests to make contributing a bit easier.
I had been using the demo hapi key for a few of the API calls (I know not great but just needed something to start with) to ensure that we got data similar to what HubSpot would actually return during real use - this worked fine with only a few tests, but after adding more (and having other contributors running the tests locally) we're hitting the daily limit for API calls on that key, which in turn causes all of our tests to fail.
Someone brought up the idea of just writing mocks for all of your APIs to test against (and we can do that if need be), but that also somewhat defeats the purpose, as we'd be maintaining an example of what each API returns, and if anything changed on HubSpot's end, we'd no longer know as we're not hitting the real API endpoints.
So I'm wondering what the best course of action is here - we could definitely mock stuff, but it's not really optimal. If there were any way to get a new hapi key specific to testing the APIs (that perhaps had a slightly higher limit on API calls), that'd be awesome! I'd love to be able to actually hit the API during tests if possible.
That's a good question. I'd actually recommend creating your own HubSpot Test Account and using that instead. That would allow you and other collaborators to continue to take advantage of the live responses, without needing to share an API limit with the broader HubSpot community.
That's a good question. I'd actually recommend creating your own HubSpot Test Account and using that instead. That would allow you and other collaborators to continue to take advantage of the live responses, without needing to share an API limit with the broader HubSpot community.
That's a great question; test portals are automatically renewed if there's any request traffic from one of the Developer Account's apps. So you could create an app to install in the test portal, and periodically make some request(s) to the test portal to keep it active indefinitely.