'Basic functionality of created filter.'

def test_created(self):

    created_ds = datetime(2010, 6, 19, 12, 0)
    q1 = QuestionFactory(title=u'q1    audio', created=created_ds)
    q1.tags.add(u'desktop')
    ans = AnswerFactory(question=q1)
    AnswerVoteFactory(answer=ans, helpful=True)
    q2 = QuestionFactory(title=u'q2    audio', created=(created_ds + timedelta(days=2)), tags=[u'desktop'])
    ans = AnswerFactory(question=q2)
    AnswerVoteFactory(answer=ans, helpful=True)
    self.refresh()
    qs = {'a': 1, 'w': 2, 'format': 'json', 'sortby': 2, 'created_date': '06/20/2010'}
    qs['created'] = constants.INTERVAL_BEFORE
    response = self.client.get(reverse('search.advanced'), qs)
    results = json.loads(response.content)['results']
    eq_([q1.get_absolute_url()], [r['url'] for r in results])
    qs['created'] = constants.INTERVAL_AFTER
    response = self.client.get(reverse('search.advanced'), qs)
    results = json.loads(response.content)['results']
    eq_([q2.get_absolute_url()], [r['url'] for r in results])
