예제 #1
0
class TemporaryImageFileTest(TestCase):

    def setUp(self):
        path = os.path.join(
            os.getcwd(),
            'photos/tests/fixtures/blake-small.jpg'
        )
        upload_file = open(path, 'rb')
        file = SimpleUploadedFile(upload_file.name, upload_file.read())
        self.tmp_file = TemporaryImageFile(file)

    def tearDown(self):
        self.tmp_file.delete()

    def test_instance(self):
        self.assertIsInstance(self.tmp_file, TemporaryImageFile)
예제 #2
0
 def setUp(self):
     path = os.path.join(
         os.getcwd(),
         'photos/tests/fixtures/blake-small.jpg'
     )
     upload_file = open(path, 'rb')
     file = SimpleUploadedFile(upload_file.name, upload_file.read())
     self.tmp_file = TemporaryImageFile(file)