'Test active contributors API call.'

def test_active_contributors(self):

    r1 = RevisionFactory()
    r2 = RevisionFactory()
    d = DocumentFactory(parent=r1.document, locale='es')
    RevisionFactory(document=d, reviewed=datetime.now(), reviewer=r1.creator, creator=r2.creator)
    u1 = UserFactory()
    for x in range(10):
        AnswerFactory(creator=u1)
    u2 = UserFactory()
    for x in range(9):
        AnswerFactory(creator=u2)
    u3 = UserFactory()
    AnswerFactory(creator=u3)
    ReplyFactory()
    self._make_contributor_metric_kinds()
    update_contributor_metrics(day=(date.today() + timedelta(days=1)))
    r = self._get_api_result('api.kpi.contributors')
    eq_(r['objects'][0]['en_us'], 2)
    eq_(r['objects'][0]['non_en_us'], 2)
    eq_(r['objects'][0]['support_forum'], 1)
    eq_(r['objects'][0]['aoa'], 1)
