]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
tests: Set 'date' when bulk creating patches
authorStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 20:21:56 +0000 (20:21 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 20:24:22 +0000 (20:24 +0000)
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 <stephen@that.guru>
Fixes: ed5e93242 ("tests: Add rudimentary pagination tests")
patchwork/tests/utils.py

index 52cd0f9b60509361428a22089955a1ebe48f8dc4..d94e889146631d64579465bb0248e1a4ff81303f 100644 (file)
@@ -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