2019-01-11 10:46:23 +00:00
|
|
|
import factory
|
2019-04-17 10:32:35 +00:00
|
|
|
from django.conf import settings
|
2019-10-16 16:12:01 +00:00
|
|
|
from django.apps import apps
|
2019-04-17 10:32:35 +00:00
|
|
|
|
2019-01-11 10:46:23 +00:00
|
|
|
from .models import Notification
|
|
|
|
from django.db.models.signals import post_save
|
|
|
|
|
|
|
|
@factory.django.mute_signals(post_save)
|
|
|
|
class NotificationFactory(factory.django.DjangoModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = Notification
|
|
|
|
|
|
|
|
type = factory.Faker('text', max_nb_chars=50)
|
|
|
|
summary = factory.Faker('paragraph', nb_sentences=3, variable_nb_sentences=True)
|
2019-05-07 09:01:26 +00:00
|
|
|
author = factory.Faker('url')
|
2019-10-16 16:12:01 +00:00
|
|
|
user = factory.Iterator(apps.get_model(settings.AUTH_USER_MODEL).objects.all())
|
2019-01-11 10:46:23 +00:00
|
|
|
date = factory.Faker('past_datetime')
|
2019-04-04 10:18:24 +00:00
|
|
|
unread = factory.Faker('boolean')
|
2019-01-11 10:46:23 +00:00
|
|
|
object = factory.Faker('url')
|