forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactories.py
More file actions
27 lines (20 loc) · 790 Bytes
/
factories.py
File metadata and controls
27 lines (20 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright The IETF Trust 2024, All Rights Reserved
import factory
from ietf.person.models import Person
from .models import Message, SendQueue
class MessageFactory(factory.django.DjangoModelFactory):
class Meta:
model = Message
by = factory.LazyFunction(lambda: Person.objects.get(name="(System)"))
subject = factory.Faker("sentence")
to = factory.Faker("email")
frm = factory.Faker("email")
cc = factory.Faker("email")
bcc = factory.Faker("email")
body = factory.Faker("paragraph")
content_type = "text/plain"
class SendQueueFactory(factory.django.DjangoModelFactory):
class Meta:
model = SendQueue
by = factory.LazyFunction(lambda: Person.objects.get(name="(System)"))
message = factory.SubFactory(MessageFactory)