Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FactoryBoy factories are coming soon! #187

Open
ADR-007 opened this issue Mar 3, 2023 · 2 comments
Open

FactoryBoy factories are coming soon! #187

ADR-007 opened this issue Mar 3, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@ADR-007
Copy link
Collaborator

ADR-007 commented Mar 3, 2023

I did PR with FireoFactory and FireoAutoFactory. I hope it will be available soon :)
Please add likes to the PR if you want to see the changes in FactoryBoy sooner :)

Usage example:

from fireo import Model
from factory_boy.fireo import FireoAutoFactory, nullable

class Comment(Model):
    text = fields.TextField()

class User(Model):
    name = fields.TextField()
    email = MyCustomEmailField()
    comments = fields.ListField(Comment)

class UserFactory(FireoAutoFactory):
    class Meta:
        model = User
        extra_mapping = {
            MyCustomEmailField: lambda maker, field: nullable(field, factory.Faker('email')),
        }

model = UserFactory.create()
assert model.name
assert model.email # works for custom fields too
assert model.comments[0].text  # works for nested models too
@ADR-007 ADR-007 changed the title FactoryBoy factories are coming soon FactoryBoy factories are coming soon! Mar 3, 2023
@AxeemHaider
Copy link
Contributor

I really appreciate your work, you are doing great. Somehow we have also update Docs So, other also knows what you have done :)

@ADR-007
Copy link
Collaborator Author

ADR-007 commented Mar 6, 2023

Yes, I have a list with updates in the documentation I need to do. I hope to do it soon :)

@ADR-007 ADR-007 added the enhancement New feature or request label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants