'Tests created/created_date filtering for forums'

def test_forums_thread_created(self):

    post_created_ds = datetime(2010, 1, 1, 12, 0)
    thread1 = ThreadFactory(title=u'crash', created=post_created_ds)
    PostFactory(thread=thread1, created=(post_created_ds + timedelta(hours=1)))
    self.refresh()
    response = self.client.get(reverse('search.advanced'), {'author': '', 'created': '2', 'created_date': '01/12/2010', 'updated': '0', 'updated_date': '', 'sortby': '0', 'a': '1', 'w': '4', 'q': 'crash', 'format': 'json'})
    eq_(200, response.status_code)
    content = json.loads(response.content)
    eq_(content['total'], 0)
    response = self.client.get(reverse('search.advanced'), {'author': '', 'created': '2', 'created_date': '01/01/2010', 'updated': '0', 'updated_date': '', 'sortby': '0', 'a': '1', 'w': '4', 'q': 'crash', 'format': 'json'})
    eq_(200, response.status_code)
    content = json.loads(response.content)
    eq_(content['total'], 1)
    response = self.client.get(reverse('search.advanced'), {'author': '', 'created': '1', 'created_date': '01/12/2010', 'updated': '0', 'updated_date': '', 'sortby': '0', 'a': '1', 'w': '4', 'q': 'crash', 'format': 'json'})
    eq_(200, response.status_code)
    content = json.loads(response.content)
    eq_(content['total'], 1)
    response = self.client.get(reverse('search.advanced'), {'author': '', 'created': '1', 'created_date': '12/31/2009', 'updated': '0', 'updated_date': '', 'sortby': '0', 'a': '1', 'w': '4', 'q': 'crash', 'format': 'json'})
    eq_(200, response.status_code)
    content = json.loads(response.content)
    eq_(content['total'], 0)
