Ejemplo n.º 1
0
 def test_url_with_cdn_url(self):
     test_file = UploadedFile()
     test_file.file = Mock()
     test_file.file.url = 'foo'
     self.assertEqual(test_file.url, 'http://example.com/foo')
Ejemplo n.º 2
0
 def test_generate_filename_existing_entry(self):
     obj = UploadedFileFactory.build()
     obj.file.name = 'bar.png'
     obj.save()
     filename = UploadedFile._generate_filename(obj, 'new_filename.boing')
     eq_(filename, 'bar.png')
Ejemplo n.º 3
0
 def test_generate_new_filename(self, uuid_mock):
     uuid_mock.uuid4.return_value = 'bar'
     file = UploadedFileFactory.build()
     UploadedFile.FILES_ROOT = 'filesroot'
     filename = UploadedFile._generate_filename(file, 'filename.boing')
     eq_(filename, 'filesroot/bar.boing')
Ejemplo n.º 4
0
 def test_url_with_cdn_url(self):
     test_file = UploadedFile()
     test_file.file = Mock()
     test_file.file.url = 'foo'
     self.assertEqual(test_file.url, 'http://example.com/foo')
Ejemplo n.º 5
0
 def test_generate_filename_existing_entry(self):
     obj = UploadedFileFactory.build()
     obj.file.name = 'bar.png'
     obj.save()
     filename = UploadedFile._generate_filename(obj, 'new_filename.boing')
     eq_(filename, 'bar.png')
Ejemplo n.º 6
0
 def test_generate_new_filename(self, uuid_mock):
     uuid_mock.uuid4.return_value = 'bar'
     file = UploadedFileFactory.build()
     UploadedFile.FILES_ROOT = 'filesroot'
     filename = UploadedFile._generate_filename(file, 'filename.boing')
     eq_(filename, 'filesroot/bar.boing')