'Suggestions API is well-formatted.'

@mock.patch.object(Site.objects, 'get_current')
def test_suggestions(self, get_current):

    get_current.return_value.domain = 'testserver'
    doc = DocumentFactory(title=u'doc1    audio', locale=u'en-US', is_archived=False)
    ApprovedRevisionFactory(document=doc, summary=u'audio', content=u'audio')
    ques = QuestionFactory(title=u'q1    audio', tags=[u'desktop'])
    ans = AnswerFactory(question=ques)
    AnswerVoteFactory(answer=ans, helpful=True)
    self.refresh()
    response = self.client.get(reverse('search.suggestions', locale='en-US'), {'q': 'audio'})
    eq_(200, response.status_code)
    eq_('application/x-suggestions+json', response['content-type'])
    results = json.loads(response.content)
    eq_('audio', results[0])
    eq_(2, len(results[1]))
    eq_(0, len(results[2]))
    eq_(2, len(results[3]))
