Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.0] Fix folder listing via file browser #15950

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/galaxy/model/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,6 @@ def check_folder_contents(self, user, roles, folder, hidden_folder_ids=""):
return True, ""
action = self.permitted_actions.DATASET_ACCESS

raise
lddas = (
self.sa_session.query(self.model.LibraryDatasetDatasetAssociation)
.join("library_dataset")
Expand Down
19 changes: 19 additions & 0 deletions lib/galaxy_test/api/test_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ def setUp(self):
def test_create(self):
folder = self._create_folder("Test Create Folder")
self._assert_valid_folder(folder)
# assert that listing items in folder works.
# this is a regression test
response = self._get(f"libraries/{folder['parent_library_id']}/contents")
response.raise_for_status()

@requires_new_library
def test_list_library(self):
library, _ = self.library_populator.fetch_single_url_to_folder()
library = self._list_library(library["id"])
assert len(library) == 2
folders = [folder for folder in library if folder["type"] == "folder"]
assert len(folders) == 1
files = [file for file in library if file["type"] == "file"]
assert len(files) == 1

@requires_new_library
def test_create_without_name_raises_400(self):
Expand Down Expand Up @@ -117,6 +131,11 @@ def test_update_deleted_raise_403(self):
put_response = self._put(f"folders/{folder_id}", data=data, admin=True, json=True)
self._assert_status_code_is(put_response, 403)

def _list_library(self, library_id):
response = self._get(f"libraries/{library_id}/contents")
response.raise_for_status()
return response.json()

def _create_folder(self, name: str):
root_folder_id = self.library["root_folder_id"]
data = {
Expand Down