'Filter by author in discussion forums.'

def test_discussion_filter_author(self):

    author_vals = (('DoesNotExist', 0), ('admin', 1), ('jsocol', 4))
    for (name, number) in author_vals:
        u = UserFactory(username=name)
        for i in range(number):
            thread1 = ThreadFactory(title=u'audio')
            PostFactory(thread=thread1, author=u)
    self.refresh()
    qs = {'a': 1, 'w': 4, 'format': 'json'}
    for (author, total) in author_vals:
        qs.update({'author': author})
        response = self.client.get(reverse('search.advanced'), qs)
        eq_(total, json.loads(response.content)['total'])
