示例#1
0
 def test_get_original_filename(self):
     self.assertEqual(get_original_filename('submission.xml_K337n8u.enc'),
                      'submission.xml.enc')
     self.assertEqual(get_original_filename('submission.xml.enc'),
                      'submission.xml.enc')
     self.assertEqual(
         get_original_filename('submission_test.xml_K337n8u.enc'),
         'submission_test.xml.enc')
     self.assertEqual(get_original_filename('submission_random.enc'),
                      'submission_random.enc')
示例#2
0
 def test_get_original_filename(self):
     self.assertEqual(
         get_original_filename('submission.xml_K337n8u.enc'),
         'submission.xml.enc'
     )
     self.assertEqual(
         get_original_filename('submission.xml.enc'),
         'submission.xml.enc'
     )
     self.assertEqual(
         get_original_filename('submission_test.xml_K337n8u.enc'),
         'submission_test.xml.enc'
     )
     self.assertEqual(
         get_original_filename('submission_random.enc'),
         'submission_random.enc'
     )
示例#3
0
def update_attachments(instance):
    """
    Takes an Instance object and updates attachment tracking fields
    """
    for attachment in instance.attachments.all():
        attachment.name = os.path.basename(
            get_original_filename(attachment.media_file.name))
        attachment.save()
    update_attachment_tracking(instance)