'Test vote API call.'

def test_vote(self):

    r = RevisionFactory(is_approved=True)
    HelpfulVoteFactory(revision=r, helpful=False)
    HelpfulVoteFactory(revision=r, helpful=False)
    HelpfulVoteFactory(revision=r, helpful=True)
    a = AnswerFactory()
    AnswerVoteFactory(answer=a, helpful=False)
    AnswerVoteFactory(answer=a, helpful=True)
    AnswerVoteFactory(answer=a, helpful=True)
    r = self._get_api_result('api.kpi.votes')
    eq_(r['objects'][0]['kb_helpful'], 1)
    eq_(r['objects'][0]['kb_votes'], 3)
    eq_(r['objects'][0]['ans_helpful'], 2)
    eq_(r['objects'][0]['ans_votes'], 3)
