Skip to main content

Factory Boy - Trytond integration

Project description

Factory-trytond

Factory-trytond is a factory_boy extension developed to work with Tryton ERP. We can create our own ERP's model factories to do some testing or to populate our databases with some sample data.

How does it work?

Steps to use Factory-trytond:

  1. Inherit the base factory class.
  2. Define the meta model the factory will construct.
  3. Define the default declarations of the factory.

Note that the meta model can be a trytond pool model name.

Here's a factory example with Tryton's model User:

import factory
import factory_trytond

class UserFactory(factory_trytond.TrytonFactory):
    class Meta:
        model = 'res.user'

    name = factory.Faker('name')
    login = factory.Faker('user_name')

user = UserFactory.build()
user.save()  # it is a standard Tryton object as would be returned by Tryton's object pool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

factory-trytond-1.0.0.tar.gz (15.2 kB view hashes)

Uploaded Source

Built Distribution

factory_trytond-1.0.0-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page