-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate seed data for dev/staging using factories #129
Conversation
This constraint prevents us from tagging a resource with the same tag more than once when we're creating TaggedItems objects via factories. This is already applied as a soft-constraint at the manager level when creating via `resource.tags.add()`, but the factories bypass it. This applies it at the DB level
Codecov Report
@@ Coverage Diff @@
## master #129 +/- ##
==========================================
+ Coverage 76.33% 81.44% +5.11%
==========================================
Files 28 29 +1
Lines 393 469 +76
==========================================
+ Hits 300 382 +82
+ Misses 93 87 -6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this! Learned a lot from your FactoryBoy setup too. Feel free to merge! :)
Closes #115
This PR adds a django management command
init_data
which can be used to populate the DB with some test data and removes the existing JSON fixtures.The test data generated is random and meaningless, so you'll end up with a resource called "Road stage could least" tagged with "blue" and "head", but as the models and tests evolve the test data we can generate should evolve with it. It also gives us flexibility about how much data we generate, for example.
It might be that there are particular conditions we want to ensure are always created in the test data. For example, one I've already ensured happens is that at least one resource has zero tags attached to it, but if we think of more we can always extend this, and it should be much easier than manipulating ~1000 line JSON files.