From 97d39b33366185cb6a1616c387be5371cd0586f6 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 5 Apr 2018 17:16:09 -0400 Subject: [PATCH] Ensure the events are returned in the correct order as these are from an outside package. Signed-off-by: Roberto Rosario --- mayan/apps/ocr/tests/test_events.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mayan/apps/ocr/tests/test_events.py b/mayan/apps/ocr/tests/test_events.py index dc329afbe7..c255fc843c 100644 --- a/mayan/apps/ocr/tests/test_events.py +++ b/mayan/apps/ocr/tests/test_events.py @@ -14,22 +14,26 @@ class OCREventsTestCase(GenericDocumentTestCase): Action.objects.all().delete() self.document.submit_for_ocr() + # Get the oldest action + action = Action.objects.order_by('-timestamp').last() + self.assertEqual( - Action.objects.last().target, self.document.latest_version + action.target, self.document.latest_version ) self.assertEqual( - Action.objects.last().verb, - event_ocr_document_version_submit.id + action.verb, event_ocr_document_version_submit.id ) def test_document_version_finish_event(self): Action.objects.all().delete() self.document.submit_for_ocr() + # Get the most recent action + action = Action.objects.order_by('-timestamp').first() + self.assertEqual( - Action.objects.first().target, self.document.latest_version + action.target, self.document.latest_version ) self.assertEqual( - Action.objects.first().verb, - event_ocr_document_version_finish.id + action.verb, event_ocr_document_version_finish.id )