danbretl / mid-tier

django webapp
1 stars 0 forks source link

API weekend date filter tests broken on weekends #103

Open rabialam opened 12 years ago

rabialam commented 12 years ago

API date filter tests (which check weekend filters) are broken if run on weekends. Culprit is date arithmetic.

rabialam commented 12 years ago

Date arithmetic fixed, but still getting a weird 500 error on api.EventRecommendationDateCategoryFilterTest.test_date_this_weekend_category_filters.

Traceback (most recent call last):

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/tastypie/resources.py", line 178, in wrapper
    response = callback(request, *args, **kwargs)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/tastypie/resources.py", line 379, in dispatch_list
    return self.dispatch('list', request, **kwargs)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/tastypie/resources.py", line 409, in dispatch
    response = method(request, **kwargs)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/tastypie/resources.py", line 980, in get_list
    objects = self.obj_get_list(request=request, **self.remove_api_resource_names(kwargs))

  File "/Users/rabi/code/abextra/mid-tier/abextra/events/resources.py", line 272, in obj_get_list
    _ = str(qs.query)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/django/db/models/sql/query.py", line 162, in __str__
    sql, params = self.get_compiler(DEFAULT_DB_ALIAS).as_sql()

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 68, in as_sql
    where, w_params = self.query.where.as_sql(qn=qn, connection=self.connection)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/django/db/models/sql/where.py", line 92, in as_sql
    sql, params = child.as_sql(qn=qn, connection=connection)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/django/db/models/sql/where.py", line 95, in as_sql
    sql, params = self.make_atom(child, qn, connection)

  File "/Users/rabi/.virtualenvs/django/lib/python2.7/site-packages/django/db/models/sql/where.py", line 179, in make_atom
    raise EmptyResultSet

EmptyResultSet
rabialam commented 12 years ago

Fixed somehow after rebasing off of master. Ready for merge.