uber / charlatan

A Python library to efficiently manage and install database fixtures
https://charlatan.readthedocs.org/en/latest/
Other
89 stars 12 forks source link

Can we have factory features in install_fixtures not just install_fixture #44

Open rahulramakrishnan opened 9 years ago

rahulramakrishnan commented 9 years ago

Currently if we want to override a field for a fixture, we have to use install_fixture like so

self.install_fixture('foo', overrides={'a': 'baz'}) self.install_fixtures(( 'foo', 'bar', 'baz' ))

however, the ability to do this inline would be nice:

self.install_fixtures(( 'foo', 'bar', 'baz', ('foo', overrides={'a': 'baz'}) ))

charlax commented 9 years ago

The problem with this is that fixtures might be different types. foo and bar might be two different models.

It seems cleaner and more intuitive to do a loop:

for name in ('foo', 'bar'):
    self.install_fixture(name, overrides={'a': 'baz'})