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
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)
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)
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')
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()