Esempio n. 1
0
 def create_clean(self, file_obj):
     """
     Shortcut to create a Signatory with a specific file.
     """
     Signatory(name='test_signatory',
               title='Test Signatory',
               image=file_obj).full_clean()
Esempio n. 2
0
 def setUp(self):
     super(TestCertificates, self).setUp()
     self.site = Site.objects.create(domain='test', name='test')
     Signatory(name='test name',
               title='test title',
               image=SimpleUploadedFile('picture1.jpg',
                                        'image contents!')).save()
     self.signatory = Signatory.objects.get(id=1)
Esempio n. 3
0
    def test_signatory_file_saving(self):
        """
        Verify that asset file is saving with actual name and on correct path.
        """
        Signatory(name='test name',
                  title='Test Signatory',
                  image=SimpleUploadedFile('image.jpg',
                                           'file contents!')).save()
        signatory = Signatory.objects.get(id=1)
        self.assertEqual(signatory.image, 'signatories/1/image.jpg')

        # Now replace the asset with another file
        signatory.image = SimpleUploadedFile('image_2.jpg', 'file contents')
        signatory.save()

        signatory = Signatory.objects.get(id=1)
        self.assertEqual(signatory.image, 'signatories/1/image_2.jpg')
Esempio n. 4
0
 def test_good_image(self):
     """Verify that saving a valid signatory image is no problem."""
     good_image = self.get_image('good')
     Signatory(name='test_signatory',
               title='Test Signatory',
               image=good_image).full_clean()