'Helper method for question vote tests.'

def common_vote(self, me_too_count=1):

    response = get(self.client, 'questions.details', args=[self.question.id])
    doc = pq(response.content)
    assert ('0\n' in doc('.have-problem')[0].text)
    eq_(me_too_count, len(doc('div.me-too    form')))
    ua = 'Mozilla/5.0    (DjangoTestClient)'
    self.client.post(reverse('questions.vote', args=[self.question.id]), {}, HTTP_USER_AGENT=ua)
    response = get(self.client, 'questions.details', args=[self.question.id])
    doc = pq(response.content)
    assert ('1\n' in doc('.have-problem')[0].text)
    eq_(0, len(doc('div.me-too    form')))
    vote_meta = VoteMetadata.objects.all()[0]
    eq_('ua', vote_meta.key)
    eq_(ua, vote_meta.value)
    post(self.client, 'questions.vote', args=[self.question.id])
    response = get(self.client, 'questions.details', args=[self.question.id])
    doc = pq(response.content)
    assert ('1\n' in doc('.have-problem')[0].text)
