You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately the model bakery's main goal is to work as an easier way to populate your database with test data than Django's fixtures. That's why we don't support form fields at all.
In my personal understanding about testing on Django, you shouldn't use tools to generate data to test your forms, because the main goal of forms are data cleaning and validation. So, if you use dynamic data, you can mislead your test code to follow the form code changes and this can introduce bugs in your system if you don't have an integration test.
The way I'm used to test forms is by defining an initial set of valid data for that form via setUp or pytest fixtures. By doing that, the unit tests can only modify part of the data and the tests are more direct and easier to read. Here's a example:
Currently model-bakery seems to mostly support db fields.
Would it be ok to also add support for form fields, specifically ChoiceField?
The use case is explained at alsur/django-admin-auto-tests#6, which is using model bakery (c.f. alsur/django-admin-auto-tests#4) to populate admin forms for smoke tests.
The text was updated successfully, but these errors were encountered: