コード例 #1
0
    def test_sum_bounties_earner(self):
        """Test sum bounties leaderboards."""
        sum_bounties(self.bounty, [self.bounty_earner_handle])

        rank_types_exists = [
            'all_all', 'all_fulfilled', 'all_earners',
            'yearly_all', 'yearly_fulfilled', 'yearly_earners',
            'monthly_all', 'monthly_fulfilled', 'monthly_earners',
            'weekly_all', 'weekly_fulfilled', 'weekly_earners',
        ]
        for rank_type in rank_types_exists:
            assert assemble_leaderboards.ranks[rank_type][self.bounty_earner_handle] == self.bounty_value

        rank_types_not_exists = [
            'all_payers', 'all_orgs', 'all_keywords', 'all_tokens',
            'all_countries', 'all_cities', 'all_continents',
            'yearly_payers', 'yearly_orgs', 'yearly_keywords', 'yearly_tokens',
            'yearly_countries', 'yearly_cities', 'yearly_continents',
            'monthly_payers', 'monthly_orgs', 'monthly_keywords', 'monthly_tokens',
            'monthly_countries', 'monthly_cities', 'monthly_continents',
            'weekly_payers', 'weekly_orgs', 'weekly_keywords', 'weekly_tokens',
            'weekly_countries', 'weekly_cities', 'weekly_continents',
        ]
        for rank_type in rank_types_not_exists:
            assert not dict(assemble_leaderboards.ranks[rank_type])
コード例 #2
0
    def test_sum_bounties(self):
        """Test sum tips of bounties leaderboards."""
        user = '******'
        total = 3

        sum_bounties(self.bounty, [user])
        print(assemble_leaderboards.ranks)

        rank_types_user = [
            'all_all', 'weekly_all', 'monthly_all', 'yearly_all'
        ]
        for rank_type in rank_types_user:
            assert assemble_leaderboards.ranks[rank_type][user] == total

        rank_types = [
            'weekly_fulfilled',
            'weekly_payers',
            'weekly_earners',
            'monthly_fulfilled',
            'monthly_payers',
            'monthly_earners',
            'yearly_fulfilled',
            'yearly_payers',
            'yearly_earners',
            'all_fulfilled',
            'all_payers',
            'all_earners',
        ]
        for rank_type in rank_types:
            assert not dict(assemble_leaderboards.ranks[rank_type])
コード例 #3
0
    def test_sum_bounties(self):
        """Test sum tips of bounties leaderboards."""
        sum_bounties(self.bounty, ['fred'])

        print(assemble_leaderboards.ranks)

        assert assemble_leaderboards.ranks['all_all']['fred'] == 3
        assert assemble_leaderboards.ranks['weekly_all']['fred'] == 3
        assert assemble_leaderboards.ranks['monthly_all']['fred'] == 3
        assert assemble_leaderboards.ranks['yearly_all']['fred'] == 3

        assert not dict(assemble_leaderboards.ranks['weekly_fulfilled'])
        assert not dict(assemble_leaderboards.ranks['weekly_payers'])
        assert not dict(assemble_leaderboards.ranks['weekly_earners'])
        assert not dict(assemble_leaderboards.ranks['monthly_fulfilled'])
        assert not dict(assemble_leaderboards.ranks['monthly_payers'])
        assert not dict(assemble_leaderboards.ranks['monthly_earners'])
        assert not dict(assemble_leaderboards.ranks['yearly_fulfilled'])
        assert not dict(assemble_leaderboards.ranks['yearly_payers'])
        assert not dict(assemble_leaderboards.ranks['yearly_earners'])
        assert not dict(assemble_leaderboards.ranks['all_fulfilled'])
        assert not dict(assemble_leaderboards.ranks['all_payers'])
        assert not dict(assemble_leaderboards.ranks['all_earners'])