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
34 lines (24 loc) · 1005 Bytes
/
factories.py
File metadata and controls
34 lines (24 loc) · 1005 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
28
29
30
31
32
33
34
# Copyright The IETF Trust 2020, All Rights Reserved
# -*- coding: utf-8 -*-
import debug # pyflakes:ignore
import factory
from ietf.doc.factories import draft_name_generator
from ietf.name.models import ExtResourceName
from ietf.submit.models import Submission, SubmissionExtResource
from ietf.utils.accesstoken import generate_random_key
class SubmissionExtResourceFactory(factory.django.DjangoModelFactory):
name = factory.Iterator(ExtResourceName.objects.all())
value = factory.Faker('url')
submission = factory.SubFactory('ietf.submit.factories.SubmissionFactory')
class Meta:
model = SubmissionExtResource
class SubmissionFactory(factory.django.DjangoModelFactory):
state_id = 'uploaded'
@factory.lazy_attribute_sequence
def name(self, n):
return draft_name_generator('draft', getattr(self, 'group', None), n)
@factory.lazy_attribute
def auth_key(self):
return generate_random_key()
class Meta:
model = Submission