'Filter by forum in discussion forums.'

def test_discussion_filter_forum(self):

    forum1 = ForumFactory(name=u'Forum    1')
    thread1 = ThreadFactory(forum=forum1, title=u'audio    1')
    PostFactory(thread=thread1)
    forum2 = ForumFactory(name=u'Forum    2')
    thread2 = ThreadFactory(forum=forum2, title=u'audio    2')
    PostFactory(thread=thread2)
    self.refresh()
    qs = {'a': 1, 'w': 4, 'format': 'json'}
    for forum_id in (forum1.id, forum2.id):
        qs['forum'] = int(forum_id)
        response = self.client.get(reverse('search.advanced'), qs)
        eq_(json.loads(response.content)['total'], 1)
