

def test_report_employee_answers(self):
    tracked_group = Group.objects.get(name='Support Forum Tracked')
    tracked_user = UserFactory()
    tracked_user.groups.add(tracked_group)
    report_group = Group.objects.get(name='Support Forum Metrics')
    report_user = UserFactory()
    report_user.groups.add(report_group)
    QuestionFactory(created=(datetime.now() - timedelta(days=2)))
    q = QuestionFactory(created=(datetime.now() - timedelta(days=2)))
    AnswerFactory(question=q)
    q = QuestionFactory(created=(datetime.now() - timedelta(days=2)))
    AnswerFactory(creator=tracked_user, question=q)
    q = QuestionFactory(created=(datetime.now() - timedelta(days=3)))
    AnswerFactory(creator=report_group, question=q)
    q = QuestionFactory(created=(datetime.now() - timedelta(days=1)))
    AnswerFactory(question=q)
    QuestionFactory()
    report_employee_answers()
    email = mail.outbox[(len(mail.outbox) - 1)]
    assert ('Number of questions asked: 3' in email.body)
    assert ('Number of questions answered: 2' in email.body)
    assert ('{username}: 1'.format(username=tracked_user.username) in email.body)
    eq_([report_user.email], email.to)

dataset/ETHPy150Open mozilla/kitsune/kitsune/questions/tests/test_cron.py TestEmployeeReportCron.test_report_employee_answers/VarMisuse@174/219 `tracked_user`->`report_group`