Created
January 4, 2017 16:33
-
-
Save ddahan/302195f9fbd0ae923fda6cb6cb13867a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# factories.py | |
class UserFactory(factory.DjangoModelFactory): | |
class Meta: | |
model = User # Le modèle à Utiliser | |
first_name = factory.Sequence(lambda n: 'Prenom%d' % n) # itération automatique | |
last_name = factory.Sequence(lambda n: 'Nom%d' % n) | |
email = factory.LazyAttribute(lambda obj: '%s.%[email protected]' \ | |
% (obj.first_name.lower(), obj.last_name.lower())) | |
password = factory.PostGenerationMethodCall('set_password', 'azerty42') | |
birth_date = FuzzyDate(date(1920, 1, 1), date(2002, 1, 1)) | |
gender = FuzzyChoice(choices=(GENDER_CHOICES[0][0], GENDER_CHOICES[1][0])) | |
email_verified = True | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment