pytition / Pytition

Django app for self-hosted privacy-friendly online petitions
https://pytition.org
BSD 3-Clause "New" or "Revised" License
100 stars 28 forks source link

Use Factoryboy to populate database in tests #221

Open numahell opened 4 years ago

numahell commented 4 years ago

Is your feature request related to a problem? Please describe. utils and dev_populate.sh are useful, but they could be improved by using Factoryboy, a tool to generate python objects related to an ORM, and it works fine with Django.

Describe the solution you'd like A file named factories.py located in petition app containing all models factories, and could be imported in tests to create test data, and used by django command, cli_pytition or whatever. Fields values can be random, or following sequences, but can be overrided on initialization with more personal values.

Describe alternatives you've considered Well it is just a nice to have, just a proposition.