mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-03-16 21:30:24 +00:00
Add user factories
This commit is contained in:
parent
a94ca83128
commit
7915c66079
2 changed files with 26 additions and 0 deletions
0
notifications/tests/factories/__init__.py
Normal file
0
notifications/tests/factories/__init__.py
Normal file
26
notifications/tests/factories/users.py
Normal file
26
notifications/tests/factories/users.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from django.conf import settings
|
||||
import factory
|
||||
|
||||
|
||||
class Recipient(factory.django.DjangoModelFactory):
|
||||
username = factory.Sequence(lambda n: f"recipient-{n}")
|
||||
first_name = factory.SelfAttribute("username")
|
||||
|
||||
class Meta:
|
||||
model = settings.AUTH_USER_MODEL
|
||||
|
||||
|
||||
class Actor(factory.django.DjangoModelFactory):
|
||||
username = factory.Sequence(lambda n: f"actor-{n}")
|
||||
first_name = factory.SelfAttribute("username")
|
||||
|
||||
class Meta:
|
||||
model = settings.AUTH_USER_MODEL
|
||||
|
||||
|
||||
class Target(factory.django.DjangoModelFactory):
|
||||
username = factory.Sequence(lambda n: f"target-{n}")
|
||||
first_name = factory.SelfAttribute("username")
|
||||
|
||||
class Meta:
|
||||
model = settings.AUTH_USER_MODEL
|
||||
Loading…
Reference in a new issue