From 6ccfaf59f8d51a28df73517354e7ce52f54337a8 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 21 Sep 2015 04:19:57 -0400 Subject: [PATCH] Add 1 second delay to workaround MySQL <5.6.4 not storing millisecond time data which is used to determine lastest version of a document. --- mayan/apps/document_signatures/tests/test_models.py | 6 ++++++ mayan/apps/documents/tests/test_api.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/mayan/apps/document_signatures/tests/test_models.py b/mayan/apps/document_signatures/tests/test_models.py index c184ffc37f..28678dbac1 100644 --- a/mayan/apps/document_signatures/tests/test_models.py +++ b/mayan/apps/document_signatures/tests/test_models.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import os +import time from django.conf import settings from django.core.files.base import File @@ -57,6 +58,11 @@ class DocumentTestCase(TestCase): file_object=File(file_object), comment='test comment 1' ) + # Artifical delay since MySQL doesn't store microsecond data in + # timestamps. Version timestamp is used to determine which version + # is the latest. + time.sleep(1) + self.assertEqual( DocumentVersionSignature.objects.has_detached_signature( self.document.latest_version diff --git a/mayan/apps/documents/tests/test_api.py b/mayan/apps/documents/tests/test_api.py index 9b00e9df19..9fa1bc02f5 100644 --- a/mayan/apps/documents/tests/test_api.py +++ b/mayan/apps/documents/tests/test_api.py @@ -178,6 +178,10 @@ class DocumentAPITestCase(APITestCase): file_object=File(file_object), ) + # Artifical delay since MySQL doesn't store microsecond data in + # timestamps. Version timestamp is used to determine which version + # is the latest. + time.sleep(1) with open(TEST_DOCUMENT_PATH) as file_descriptor: response = self.client.post( reverse(