commit 99fd94580f95dcbfb77b73e2de846f76a5709ef9
Author: Sonny <sonnyba871@gmail.com>
Date: Sat Feb 15 21:45:16 2020 +0100
Use postgres password
As of https://gitlab.com/gitlab-com/support-forum/issues/5199
30 lines
850 B
Python
30 lines
850 B
Python
import factory
|
|
|
|
from newsreader.accounts.tests.factories import UserFactory
|
|
from newsreader.news.collection.choices import RuleTypeChoices
|
|
from newsreader.news.collection.models import CollectionRule
|
|
from newsreader.news.collection.reddit import REDDIT_URL
|
|
|
|
|
|
class CollectionRuleFactory(factory.django.DjangoModelFactory):
|
|
name = factory.Sequence(lambda n: "CollectionRule-{}".format(n))
|
|
url = factory.Faker("url")
|
|
website_url = factory.Faker("url")
|
|
|
|
category = factory.SubFactory(
|
|
"newsreader.news.core.tests.factories.CategoryFactory"
|
|
)
|
|
|
|
user = factory.SubFactory(UserFactory)
|
|
|
|
class Meta:
|
|
model = CollectionRule
|
|
|
|
|
|
class FeedFactory(CollectionRuleFactory):
|
|
type = RuleTypeChoices.feed
|
|
|
|
|
|
class SubredditFactory(CollectionRuleFactory):
|
|
type = RuleTypeChoices.subreddit
|
|
website_url = REDDIT_URL
|