¡Esta es una revisión vieja del documento!
Factory Boy aim is to replace static and hard to maintain complex object fixtures (test data).
This is test data created with factory boy (We need a 200€, paid order, shipping to australia, for a VIP customer):
def test_with_factory_boy(self): order = OrderFactory( amount=200, status='PAID', customer__is_vip=True, address__country='AU', )
This is data created without factory boy:
def test_without_factory_boy(self): address = Address( street="42 fubar street", zipcode="42Z42", city="Sydney", country="AU", ) customer = Customer( first_name="John", last_name="Doe", phone="+1234", email="john.doe@example.org", active=True, is_vip=True, address=address, )
$ pip install factory_boy