예제 #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
예제 #2
0
 def test_deletes_folder_on_success(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.create_folder(self.path)
     storage.delete_folder(self.path)
     assert not os.path.exists(self.path)
예제 #3
0
 def test_raises_exception_on_folder_conflict(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.create_folder(self.path)
     with raises(StorageException):
         storage.create_folder(self.path)
예제 #4
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')
예제 #5
0
 def test_returns_list_of_folders_on_success(self):
     storage = FileSystemStorage(os.path.dirname(__file__))
     storage.create_folder(self.path)
     assert 'uploads' in storage.list_folders()