You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
799 B
43 lines
799 B
7 years ago
|
"""
|
||
|
These factories are used to generate fake data for testing.
|
||
|
"""
|
||
|
import factory
|
||
|
from . import models
|
||
|
from ... import constants
|
||
|
from factory.django import DjangoModelFactory
|
||
|
|
||
|
|
||
|
class StatementFactory(DjangoModelFactory):
|
||
|
|
||
|
text = factory.Faker(
|
||
|
'text',
|
||
|
max_nb_chars=constants.STATEMENT_TEXT_MAX_LENGTH
|
||
|
)
|
||
|
|
||
|
class Meta:
|
||
|
model = models.Statement
|
||
|
|
||
|
|
||
|
class ResponseFactory(DjangoModelFactory):
|
||
|
|
||
|
statement = factory.SubFactory(StatementFactory)
|
||
|
|
||
|
response = factory.SubFactory(StatementFactory)
|
||
|
|
||
|
class Meta:
|
||
|
model = models.Response
|
||
|
|
||
|
|
||
|
class ConversationFactory(DjangoModelFactory):
|
||
|
|
||
|
class Meta:
|
||
|
model = models.Conversation
|
||
|
|
||
|
|
||
|
class TagFactory(DjangoModelFactory):
|
||
|
|
||
|
name = factory.Faker('word')
|
||
|
|
||
|
class Meta:
|
||
|
model = models.Tag
|