コード例 #1
0
ファイル: test_models.py プロジェクト: EliotBerriot/1flow
    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()
コード例 #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()
コード例 #3
0
ファイル: test_models.py プロジェクト: EliotBerriot/1flow
 def tearDown(self):
     WebSite.drop_collection()
     Article.drop_collection()
コード例 #4
0
ファイル: test_models.py プロジェクト: EliotBerriot/1flow
# 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
        no_dupe   = 0
        no_mutual = 0

        self.assertEquals(t(1000, some_news, no_mutual, no_dupe,
                          'etag', 'last_modified'), 540.0)
コード例 #5
0
 def tearDown(self):
     WebSite.drop_collection()
     Article.drop_collection()
コード例 #6
0
# 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
        no_dupe = 0
        no_mutual = 0

        self.assertEquals(
            t(1000, some_news, no_mutual, no_dupe, 'etag', 'last_modified'),
            540.0)