From 7db560d7990fcdc7126fe37886d496823b579fd7 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 12:10:42 -0400 Subject: [PATCH] Increase delay in test from 1 second to 2 seconds to workaround MySQL truncating millisecond part of timestamp. --- mayan/apps/documents/tests/test_models.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index 0e844013b6..52945f03f1 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -85,8 +85,8 @@ class DocumentTestCase(TestCase): def test_auto_trashing(self): """ - Test document type trashing policies. Documents are moved to the trash, - x amount of time after being uploaded + Test document type trashing policies. Documents are moved to the + trash, x amount of time after being uploaded """ self.document_type.trash_time_period = 1 @@ -94,7 +94,9 @@ class DocumentTestCase(TestCase): self.document_type.trash_time_unit = 'seconds' self.document_type.save() - time.sleep(1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field + time.sleep(2) self.assertEqual(Document.objects.count(), 1) self.assertEqual(DeletedDocument.objects.count(), 0) @@ -123,6 +125,8 @@ class DocumentTestCase(TestCase): self.assertEqual(Document.objects.count(), 0) self.assertEqual(DeletedDocument.objects.count(), 1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field time.sleep(2) DocumentType.objects.check_delete_periods() @@ -216,8 +220,9 @@ class DocumentVersionTestCase(TestCase): def test_revert_version(self): self.assertEqual(self.document.versions.count(), 1) - # Needed by MySQL as milliseconds value is not store in timestamp field - time.sleep(1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field + time.sleep(2) with open(TEST_DOCUMENT_PATH) as file_object: self.document.new_version(