Skip to content

Commit

Permalink
Merge branch 'release_23.1' into release_23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Dec 14, 2023
2 parents 1449190 + f6c06f6 commit 1fd9cf3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def name_filter(term):
term,
)
)
stmt = stmt.where(StoredWorkflow.deleted == (true() if show_deleted else false()))
stmt = stmt.where(StoredWorkflow.deleted == (true() if show_deleted else false())).distinct()
if include_total_count:
total_matches = get_count(trans.sa_session, stmt)
else:
Expand Down
27 changes: 27 additions & 0 deletions lib/galaxy_test/api/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,33 @@ def test_index_parameter_invalid_combinations(self):
self._assert_status_code_is(response, 400)
self._assert_error_code_is(response, error_codes.error_codes_by_name["USER_REQUEST_INVALID_PARAMETER"])

def test_index_total_matches(self):
with self._different_user("[email protected]"):
my_workflow_id = self.workflow_populator.simple_workflow("mine_1")
self.workflow_populator.simple_workflow("mine_2")
my_email = self.dataset_populator.user_email()
with self._different_user():
their_shared_workflow_id = self.workflow_populator.simple_workflow("theirs_1")
self.workflow_populator.share_with_user(their_shared_workflow_id, my_email)
their_workflow_to_import_id = self.workflow_populator.simple_workflow("theirs_2", publish=True)
self.workflow_populator.set_tags(their_workflow_to_import_id, ["theirs_2", "test"])

import_response = self.__import_workflow(their_workflow_to_import_id)
self._assert_status_code_is(import_response, 200)
imported_wf_id = import_response.json()["id"]

# add tags to my workflows
self.workflow_populator.set_tags(my_workflow_id, ["mine_1", "test"])
self.workflow_populator.set_tags(imported_wf_id, ["imported", "test"])

# We should have 4 workflows now (2 mine, 1 shared with me, 1 imported)
expected_number_of_workflows = 4
workflows_response = self._get("workflows")
self._assert_status_code_is(workflows_response, 200)
assert workflows_response.headers["Total_matches"] == f"{expected_number_of_workflows}"
workflows = workflows_response.json()
assert len(workflows) == expected_number_of_workflows

def test_upload(self):
self.__test_upload(use_deprecated_route=False)

Expand Down

0 comments on commit 1fd9cf3

Please sign in to comment.