Ejemplo n.º 1
0
 def test_conflict_exception_contains_proper_status_code(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.save('uploads', 'some text')
     try:
         storage.create_folder('uploads')
         assert False
     except StorageException, e:
         assert e.status_code == 409
         assert e.message
Ejemplo n.º 2
0
 def test_returns_file_object_on_success(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     obj = storage.save(self.file, 'value')
     assert obj.name == self.file
Ejemplo n.º 3
0
 def test_raises_exception_on_file_conflict(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.save('uploads', 'some text')
     with raises(StorageException):
         storage.create_folder('uploads')
Ejemplo n.º 4
0
 def test_returns_file_object_on_success(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.save(self.file, 'something')
     file_ = storage.open(self.file, 'rb')
     assert isinstance(file_, FileSystemStorageFile)