コード例 #1
0
ファイル: test_cron.py プロジェクト: DWDRAEGER/kitsune
    def test_old_articles_helpful(self):
        """Doesn't return helpful votes within range"""
        r = _make_backdated_revision(90)

        for x in range(0, 4):
            _add_vote_in_past(r, 1, 10)

        _add_vote_in_past(r, 0, 10)

        result = _get_old_unhelpful()
        eq_(0, len(result))
コード例 #2
0
    def test_old_articles_helpful(self):
        """Doesn't return helpful votes within range"""
        r = _make_backdated_revision(90)

        for x in range(0, 4):
            _add_vote_in_past(r, 1, 10)

        _add_vote_in_past(r, 0, 10)

        result = _get_old_unhelpful()
        eq_(0, len(result))
コード例 #3
0
ファイル: test_cron.py プロジェクト: Apokalyptica79/kitsune
    def test_old_articles_helpful(self):
        """
        Make sure _get_old_unhelpful() doesn't return a helpful (no < yes)
        with votes within time range.
        """
        r = _make_backdated_revision(90)

        for x in range(0, 4):
            _add_vote_in_past(r, 1, 10)

        _add_vote_in_past(r, 0, 10)

        result = _get_old_unhelpful()
        eq_(0, len(result))
コード例 #4
0
ファイル: test_cron.py プロジェクト: ibai/kitsune
    def test_old_articles_helpful(self):
        """
        Make sure _get_old_unhelpful() doesn't return a helpful (no < yes)
        with votes within time range.
        """
        r = _make_backdated_revision(90)

        for x in range(0, 4):
            _add_vote_in_past(r, 1, 10)

        _add_vote_in_past(r, 0, 10)

        result = _get_old_unhelpful()
        eq_(0, len(result))
コード例 #5
0
ファイル: test_cron.py プロジェクト: DWDRAEGER/kitsune
    def test_old_articles(self):
        """Returns unhelpful votes within time range"""
        r = _make_backdated_revision(90)

        # Add 4 no votes 1.5 months ago
        for x in range(0, 4):
            _add_vote_in_past(r, 0, 10)

        # Add 1 yes vote 1.5 months ago
        _add_vote_in_past(r, 1, 10)

        result = _get_old_unhelpful()
        eq_(1, len(result))
        self.assertAlmostEqual(0.2, result[r.id]['percentage'])
        eq_(5, result[r.id]['total'])
コード例 #6
0
    def test_old_articles(self):
        """Returns unhelpful votes within time range"""
        r = _make_backdated_revision(90)

        # Add 4 no votes 1.5 months ago
        for x in range(0, 4):
            _add_vote_in_past(r, 0, 10)

        # Add 1 yes vote 1.5 months ago
        _add_vote_in_past(r, 1, 10)

        result = _get_old_unhelpful()
        eq_(1, len(result))
        self.assertAlmostEqual(0.2, result[r.id]['percentage'])
        eq_(5, result[r.id]['total'])
コード例 #7
0
ファイル: test_cron.py プロジェクト: erikrose/kitsune
    def test_old_articles(self):
        """
        Make sure _get_old_unhelpful() returns an unhelpful (no > yes) with
        votes within time range.
        """
        r = _make_backdated_revision(90)

        # Add 4 no votes 1.5 months ago
        for x in range(0, 4):
            _add_vote_in_past(r, 0, 45)

        # Add 1 yes vote 1.5 months ago
        _add_vote_in_past(r, 1, 45)

        result = _get_old_unhelpful()
        eq_(1, len(result))
        self.assertAlmostEqual(0.2, result[r.id]["percentage"])
        eq_(5, result[r.id]["total"])
コード例 #8
0
ファイル: test_cron.py プロジェクト: Apokalyptica79/kitsune
 def test_no_old_articles(self):
     """Make sure _get_old_articles() returns nothing with no votes."""
     result = _get_old_unhelpful()
     eq_(0, len(result))
コード例 #9
0
ファイル: test_cron.py プロジェクト: ibai/kitsune
 def test_no_old_articles(self):
     """Make sure _get_old_articles() returns nothing with no votes."""
     result = _get_old_unhelpful()
     eq_(0, len(result))