'Test that voting works for anonymous user.'

def test_vote_anonymous(self):

    r = self.document.current_revision
    referrer = 'search'
    query = 'cookies'
    response = post(self.client, 'wiki.document_vote', {'helpful': 'Yes', 'revision_id': r.id, 'referrer': referrer, 'query': query}, args=[self.document.slug])
    eq_(200, response.status_code)
    votes = HelpfulVote.objects.filter(revision=r, creator=None)
    votes = votes.exclude(anonymous_id=None)
    eq_(1, votes.count())
    assert votes[0].helpful
    metadata = HelpfulVoteMetadata.objects.values_list('key', 'value')
    eq_(2, len(metadata))
    metadata_dict = dict(((k, v) for (k, v) in metadata))
    eq_(referrer, metadata_dict['referrer'])
    eq_(query, metadata_dict['query'])
