選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

46 行
1.0 KiB

  1. import factory
  2. from api import models
  3. class UserFactory(factory.DjangoModelFactory):
  4. class Meta:
  5. model = models.LessPassUser
  6. email = factory.Sequence(lambda n: 'u{0}@lesspass.com'.format(n))
  7. password = factory.PostGenerationMethodCall('set_password', 'password')
  8. is_admin = False
  9. class AdminFactory(UserFactory):
  10. is_admin = True
  11. class PasswordInfoFactory(factory.DjangoModelFactory):
  12. class Meta:
  13. model = models.PasswordInfo
  14. settings = '["lowercase", "uppercase", "numbers", "symbols"]'
  15. class EntryFactory(factory.DjangoModelFactory):
  16. class Meta:
  17. model = models.Entry
  18. user = factory.SubFactory(UserFactory)
  19. password = factory.SubFactory(PasswordInfoFactory)
  20. title = 'twitter'
  21. site = 'twitter'
  22. username = 'guillaume20100'
  23. url = 'https://twitter.com/'
  24. class PasswordFactory(factory.DjangoModelFactory):
  25. class Meta:
  26. model = models.Password
  27. user = factory.SubFactory(UserFactory)
  28. login = 'admin@oslab.fr'
  29. site = 'lesspass.com'