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
Now, let's imagine we have a test scenario for my MainModel which depends on the optional field from a optional_fk to have some random value so the test can pass.
Model mommy already solves this test setup scenario, but I think we could also be able to do so via _fill_optional with lookup fields. In my opinion, this would increase model mommy's API because we already can use lookup fields to create or prepare instances and recipes.
Expected behavior
My suggestions is to add the lookup feature also to the _fill_optional value. So, the following call would be valid:
Right now, model_mommy force us to manually create an instance of FKModel with the optional fields being populated and then to pass is to mommy.make when creating a new instance of MainModel. Here's how we have to code the same test scenario today:
I'll base my feature request using the following models as examples:
Now, let's imagine we have a test scenario for my
MainModel
which depends on theoptional
field from aoptional_fk
to have some random value so the test can pass.Model mommy already solves this test setup scenario, but I think we could also be able to do so via
_fill_optional
with lookup fields. In my opinion, this would increase model mommy's API because we already can use lookup fields to create or prepare instances and recipes.Expected behavior
My suggestions is to add the lookup feature also to the
_fill_optional
value. So, the following call would be valid:Actual behavior
Right now,
model_mommy
force us to manually create an instance ofFKModel
with the optional fields being populated and then to pass is tomommy.make
when creating a new instance ofMainModel
. Here's how we have to code the same test scenario today:The text was updated successfully, but these errors were encountered: