'Give helpful_vote a survey that is too long.
It should be truncated safely, instead of generating bad JSON.'

def test_unhelpful_truncation(self):

    vote = HelpfulVoteFactory()
    too_long_comment = (('lorem    ipsum' * 100) + 'bad    data')
    self.client.post(reverse('wiki.unhelpful_survey'), {'vote_id': vote.id, 'button': 'Submit', 'comment': too_long_comment})
    vote_meta = vote.metadata.all()[0]
    survey = json.loads(vote_meta.value)
    assert ('bad    data' not in survey['comment'])
