def setUp(self): # NOTE: we need real web pages, else the absolutization won't work or # will find duplicates and tests will fail for a real-life reason. self.article1 = Article(title='test1', url='http://blog.1flow.io/post/' '59410536612/1flow-blog-has-moved').save() self.feed = Feed(name='1flow test feed', url='http://blog.1flow.io/rss').save() self.article1.update(add_to_set__feeds=self.feed) self.article1.reload() # User & Reads creation for index in xrange(1, 2): username = '******' % index du = DjangoUser.objects.create(username=username, email='*****@*****.**' % username) # PG post_save() signal already created the MongoDB user. u = du.mongo Read(user=u, article=self.article1).save() Subscription(user=u, feed=self.feed).save() for index in xrange(2, 5): username = '******' % index du = DjangoUser.objects.create(username=username, email='*****@*****.**' % username)
def setUp(self): # NOTE: we need real web pages, else the absolutization won't work or # will find duplicates and tests will fail for a real-life reason. self.article1 = Article(title='test1', url='http://blog.1flow.io/post/' '59410536612/1flow-blog-has-moved').save() self.article2 = Article(title='test2', url='http://obi.1flow.io/fr/').save() self.article3 = Article(title='test3', url='http://obi.1flow.io/en/').save() # User & Reads creation for index in xrange(1, 6): username = '******' % index du = DjangoUser.objects.create(username=username, email='*****@*****.**' % username) # NOTE: the mongoDB user is created automatically. If you # try to create one it will fail with duplicate index error. u = du.mongo Read(user=u, article=self.article1).save() for index in xrange(6, 11): username = '******' % index du = DjangoUser.objects.create(username=username, email='*****@*****.**' % username) u = du.mongo Read(user=u, article=self.article2).save() # Feeds creation for index in xrange(1, 6): f = Feed(name='test feed #%s' % index, url='http://test-feed%s.com' % index).save() self.article1.update(add_to_set__feeds=f) self.article1.reload() for index in xrange(6, 11): f = Feed(name='test feed #%s' % index, url='http://test-feed%s.com' % index).save() self.article2.update(add_to_set__feeds=f) self.article2.reload()
def tearDown(self): Article.drop_collection() User.drop_collection() Read.drop_collection() Feed.drop_collection()
def tearDown(self): Subscription.drop_collection() Feed.drop_collection() Read.drop_collection() Article.drop_collection() User.drop_collection()
from oneflow.base.utils import RedisStatsCounter from oneflow.base.tests import (connect_mongodb_testsuite, TEST_REDIS) DjangoUser = get_user_model() LOGGER = logging.getLogger(__file__) # Use the test database not to pollute the production/development one. RedisStatsCounter.REDIS = TEST_REDIS TEST_REDIS.flushdb() connect_mongodb_testsuite() # Empty the database before starting in case an old test failed to tearDown(). Article.drop_collection() Read.drop_collection() User.drop_collection() Group.drop_collection() Feed.drop_collection() Tag.drop_collection() Folder.drop_collection() WebSite.drop_collection() Author.drop_collection() class ThrottleIntervalTest(TestCase): def test_lower_interval_with_etag_or_modified(self): t = Feed.throttle_fetch_interval
from oneflow.base.utils import RedisStatsCounter from oneflow.base.tests import (connect_mongodb_testsuite, TEST_REDIS) DjangoUser = get_user_model() LOGGER = logging.getLogger(__file__) # Use the test database not to pollute the production/development one. RedisStatsCounter.REDIS = TEST_REDIS TEST_REDIS.flushdb() connect_mongodb_testsuite() # Empty the database before starting in case an old test failed to tearDown(). Article.drop_collection() Read.drop_collection() User.drop_collection() Group.drop_collection() Feed.drop_collection() Tag.drop_collection() Folder.drop_collection() WebSite.drop_collection() Author.drop_collection() class ThrottleIntervalTest(TestCase): def test_lower_interval_with_etag_or_modified(self): t = Feed.throttle_fetch_interval some_news = 10