Exemplo n.º 1
0
    def setUp(self):

        WebSite.drop_collection()
        Article.drop_collection()

        self.ws1 = WebSite(url='http://test1.com').save()
        self.ws2 = WebSite(url='http://test2.com').save()
Exemplo n.º 2
0
    def setUp(self):

        WebSite.drop_collection()
        Article.drop_collection()

        self.ws1 = WebSite(url='http://test1.com').save()
        self.ws2 = WebSite(url='http://test2.com').save()
Exemplo n.º 3
0
 def tearDown(self):
     Article.drop_collection()
Exemplo n.º 4
0
import logging

from django.test import TestCase
from django.test.utils import override_settings

from oneflow.base.tests import connect_mongodb_testsuite
from oneflow.core.models import Article
from oneflow.core.stats import (PythonErrorClassifier, GenericErrorClassifier,
                                UrlErrorClassifier, ContentErrorClassifier)

LOGGER = logging.getLogger(__file__)

connect_mongodb_testsuite()

Article.drop_collection()


@override_settings(STATICFILES_STORAGE=
                   'pipeline.storage.NonPackagingPipelineStorage',
                   CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
                   CELERY_ALWAYS_EAGER=True,
                   BROKER_BACKEND='memory',)
class ErrorClassifierTests(TestCase):

    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.
        # Here we need to keep an article without any url_error, so we have
        # to make it point to a real working URL.
Exemplo n.º 5
0
 def tearDown(self):
     WebSite.drop_collection()
     Article.drop_collection()
Exemplo n.º 6
0
 def tearDown(self):
     Article.drop_collection()
     User.drop_collection()
     Read.drop_collection()
     Feed.drop_collection()
Exemplo n.º 7
0
 def tearDown(self):
     Subscription.drop_collection()
     Feed.drop_collection()
     Read.drop_collection()
     Article.drop_collection()
     User.drop_collection()
Exemplo n.º 8
0
 def tearDown(self):
     WebSite.drop_collection()
     Article.drop_collection()
Exemplo n.º 9
0
 def tearDown(self):
     Article.drop_collection()
     Feed.drop_collection()
Exemplo n.º 10
0
 def tearDown(self):
     Subscription.drop_collection()
     Feed.drop_collection()
     Read.drop_collection()
     Article.drop_collection()
     User.drop_collection()
Exemplo n.º 11
0
from oneflow.core.tasks import global_feeds_checker
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