Closed jordanb closed 10 years ago
I'm still uncomfortable with this, as it is too framework specific... What do you think of using this: http://peewee.readthedocs.org/en/latest/peewee/playhouse.html#test-utils
Will still think through this though.
Thank you for your feedback. This feature was not meant to support peewee only. It does have assumptions about the framework but:
save
method on the models, like charlatan does currentlydelete_instance
or delete
methodbefore_delete
hook was indeed added)@charlax Let me know what you think.
Looking great, left a few comments. Making it totally ORM agnostic would be great but probably out of scope.
Can you add some more tests and a bit more documentation?
Thanks a lot Jordan!
This feature adds the capability to uninstall fixtures using one or a set of fixture keys.
We know that the
FixturesManager
class has asave_instance
method and severalinstall_fixture
related methods. In a similar way and for parity sake we add adelete_instance
as well as severaluninstall_fixture
methods.Why is that useful?
This is how things were before:
And now you'll be able to do:
How the magic works?
When calling
FixturesManager.delete_instance
, the logic expects (and hopes) that your model instance will have aModel.delete_instance()
method or aModel.delete()
method. If it has both, onlyModel.delete_instance
will be called. This works for peewee and other standard orm. It is very similar to how theFixturesManager.save_instance
method relies on theModel.save()
method being defined by your orm.Limitations