mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-04-13 09:42:01 +00:00
35 lines
976 B
Python
35 lines
976 B
Python
import factory
|
|
from django.conf import settings
|
|
from factory.django import DjangoModelFactory
|
|
from factory.fuzzy import FuzzyAttribute
|
|
from faker import Faker
|
|
|
|
from apps.rss_feeds.models import DuplicateFeed, Feed
|
|
|
|
NEWSBLUR_DIR = settings.NEWSBLUR_DIR
|
|
fake = Faker()
|
|
|
|
|
|
def generate_address():
|
|
return f"{NEWSBLUR_DIR}/apps/analyzer/fixtures/{fake.word()}.xml"
|
|
|
|
|
|
class FeedFactory(DjangoModelFactory):
|
|
feed_address = FuzzyAttribute(generate_address)
|
|
feed_link = FuzzyAttribute(generate_address)
|
|
creation = factory.Faker("date")
|
|
feed_title = factory.Faker("sentence")
|
|
last_update = factory.Faker("date_time")
|
|
next_scheduled_update = factory.Faker("date_time")
|
|
last_story_date = factory.Faker("date_time")
|
|
min_to_decay = 1
|
|
last_modified = factory.Faker("date_time")
|
|
hash_address_and_link = fake.sha1()
|
|
|
|
class Meta:
|
|
model = Feed
|
|
|
|
|
|
class DuplicateFeedFactory(DjangoModelFactory):
|
|
class Meta:
|
|
model = DuplicateFeed
|