'AttachmentRevision.get_previous() should return this revisions\'s
files\'s most recent approved revision.'

def test_get_previous(self):

    test_user = self.user_model.objects.get(username='testuser2')
    attachment = Attachment(title='Test    attachment    for    get_previous')
    attachment.save()
    revision1 = AttachmentRevision(attachment=attachment, mime_type='text/plain', title=attachment.title, description='', comment='Initial    revision.', created=(datetime.datetime.now() - datetime.timedelta(seconds=30)), creator=test_user, is_approved=True)
    revision1.file.save('get_previous_test_file.txt', ContentFile('I    am    a    test    file    for    get_previous'))
    revision1.save()
    revision1.make_current()
    revision2 = AttachmentRevision(attachment=attachment, mime_type='text/plain', title=attachment.title, description='', comment='First    edit..', created=datetime.datetime.now(), creator=test_user, is_approved=True)
    revision2.file.save('get_previous_test_file.txt', ContentFile('I    am    a    test    file    for    get_previous'))
    revision2.save()
    revision2.make_current()
    self.assertEqual(revision1, revision2.get_previous())
