def test_remove_folder(): folder = Folder({}) folder._delete_url = 'http://delete.me/uri' folder._delete = MagicMock(return_value=FakeResponse(204, {'data': {}})) folder.remove() assert folder._delete.called
def test_remove_folder_failed(): folder = Folder({}) folder.path = 'some/path' folder._delete_url = 'http://delete.me/uri' folder._delete = MagicMock(return_value=FakeResponse(404, {'data': {}})) with pytest.raises(RuntimeError) as e: folder.remove() assert folder._delete.called assert 'Could not delete' in e.value.args[0]