Ensure the events are returned in the correct order as these are from an outside package.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-04-05 17:16:09 -04:00
parent c7c5df1190
commit 97d39b3336

View File

@@ -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
)