Best practices for testing API packages

I am a big fan of mocking for API requests, but I’ve had trouble thinking through how to do this effectively in R. I’m very excited that someone is working on porting vcr.

I have this same problem not just with APIs but also things like database connectors. For example, I have a function that basically creates a RJDBC connection regardless of the database source, selecting the right driverClass and classPath, but it’s a bit hard to conceptualize how to test this and test code that’s meant to then successfully execute a SQL query on that connection.