What I’m trying to do:
I’m more or less trying to replicate the testing flow that factory_boy
and django
provide, where you can use factories to churn out new database row objects at will into a test database. At the end of test execution, the test database should be automatically destroyed.
For example, let’s say I want to test that a function’s behavior in the case of a user having or not having some permissions. Per my own implementation, I would need to create rows in my User, Roles, and Permissions tables to test the functionality, and then I’d need those rows to be deleted.
What I’ve tried and what’s not working:
I honestly don’t even know where to start. I’ve tried checking the forums for any answers, found none. The only strategy I could think of so far, which is a bit messy and painful, is to manually spin up test tables and then delete them when done testing. The flow I described in the section above is far simpler and more robust.