From: Stephen Finucane Date: Fri, 23 Dec 2016 20:21:56 +0000 (+0000) Subject: tests: Set 'date' when bulk creating patches X-Git-Tag: v2.0.0-rc1~134 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9109e012a1efd99a9158ab7d909342709f0ee783;p=thirdparty%2Fpatchwork.git tests: Set 'date' when bulk creating patches Apparently Django 1.8+ changed how patches with identical 'date' fields were ordered, meaning tests that worked on these versions failed on previous versions. Signed-off-by: Stephen Finucane Fixes: ed5e93242 ("tests: Add rudimentary pagination tests") --- diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py index 52cd0f9b..d94e8891 100644 --- a/patchwork/tests/utils.py +++ b/patchwork/tests/utils.py @@ -19,6 +19,7 @@ import codecs from datetime import datetime as dt +from datetime import timedelta from email.utils import make_msgid import os @@ -254,10 +255,12 @@ def _create_submissions(create_func, count=1, **kwargs): 'submitter': create_person() if 'submitter' not in kwargs else None, } values.update(kwargs) + date = dt.now() objects = [] for i in range(0, count): - obj = create_func(**values) + obj = create_func(date=date + timedelta(minutes=i), + **values) objects.append(obj) return objects