Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

34 rader
762 B

  1. import factory
  2. from factory.django import DjangoModelFactory
  3. from api import models
  4. class UserFactory(DjangoModelFactory):
  5. class Meta:
  6. model = models.LessPassUser
  7. email = factory.Sequence(lambda n: "u{0}@lesspass.com".format(n))
  8. password = factory.PostGenerationMethodCall("set_password", "password")
  9. is_admin = False
  10. class AdminFactory(UserFactory):
  11. is_admin = True
  12. class PasswordFactory(DjangoModelFactory):
  13. class Meta:
  14. model = models.Password
  15. user = factory.SubFactory(UserFactory)
  16. login = "admin@oslab.fr"
  17. site = "lesspass.com"
  18. class EncryptedPasswordProfileFactory(DjangoModelFactory):
  19. class Meta:
  20. model = models.EncryptedPasswordProfile
  21. user = factory.SubFactory(UserFactory)