Fix queue tests for MySQL

MySQL's date time's appear to have a 1 second threshold, so we need to make sure the queue items added for the tests are available as soon as they are added. Before this change, the available_after was set to `datetime.utcnow()`, and, if the `get` was called within 1 second, then its check would fail.
This commit is contained in:
Joseph Schorr 2016-07-14 17:11:04 -04:00
parent 4e1259b58a
commit b0b7b63be9
2 changed files with 14 additions and 10 deletions

View file

@ -6,6 +6,10 @@ def paginate(query, model, descending=False, page_token=None, limit=50, id_alias
next page, if any. If descending is set to True, orders by the ID descending rather
than ascending.
"""
# Note: We use the id_alias for the order_by, but not the where below. The alias is necessary
# for certain queries that use unions in MySQL, as it gets confused on which ID to order by.
# The where clause, on the other hand, cannot use the alias because Postgres does not allow
# aliases in where clauses.
id_field = model.id
if id_alias is not None:
id_field = SQL(id_alias)