diff --git a/lib/galaxy/managers/datasets.py b/lib/galaxy/managers/datasets.py index 3a23a25e19a1..612efddfeffe 100644 --- a/lib/galaxy/managers/datasets.py +++ b/lib/galaxy/managers/datasets.py @@ -64,7 +64,7 @@ def __init__(self, app: MinimalManagerApp): self.quota_agent = app.quota_agent self.security_agent = app.model.security_agent - def create(self, manage_roles=None, access_roles=None, flush=True, **kwargs): + def create_for_unit_testing(self, manage_roles=None, access_roles=None, flush=True, **kwargs): """ Create and return a new Dataset object. """ diff --git a/test/unit/app/managers/test_DatasetManager.py b/test/unit/app/managers/test_DatasetManager.py index 91f891829fb6..419837de2aa0 100644 --- a/test/unit/app/managers/test_DatasetManager.py +++ b/test/unit/app/managers/test_DatasetManager.py @@ -33,13 +33,13 @@ def set_up_managers(self): def test_create(self): self.log("should be able to create a new Dataset") - dataset1 = self.dataset_manager.create() + dataset1 = self.dataset_manager.create_for_unit_testing() assert isinstance(dataset1, model.Dataset) assert dataset1 == self.trans.sa_session.get(model.Dataset, dataset1.id) def test_base(self): - dataset1 = self.dataset_manager.create() - dataset2 = self.dataset_manager.create() + dataset1 = self.dataset_manager.create_for_unit_testing() + dataset2 = self.dataset_manager.create_for_unit_testing() self.log("should be able to query") datasets = self.trans.sa_session.scalars(select(model.Dataset)).all() @@ -60,7 +60,7 @@ def test_base(self): assert self.dataset_manager.list(order_by=sqlalchemy.desc(model.Dataset.create_time)) == [dataset2, dataset1] def test_delete(self): - item1 = self.dataset_manager.create() + item1 = self.dataset_manager.create_for_unit_testing() self.log("should be able to delete and undelete a dataset") assert not item1.deleted @@ -71,7 +71,7 @@ def test_delete(self): def test_purge_allowed(self): self.trans.app.config.allow_user_dataset_purge = True - item1 = self.dataset_manager.create() + item1 = self.dataset_manager.create_for_unit_testing() self.log("should purge a dataset if config does allow") assert not item1.purged @@ -83,7 +83,7 @@ def test_purge_allowed(self): def test_purge_not_allowed(self): self.trans.app.config.allow_user_dataset_purge = False - item1 = self.dataset_manager.create() + item1 = self.dataset_manager.create_for_unit_testing() self.log("should raise an error when purging a dataset if config does not allow") assert not item1.purged @@ -93,7 +93,7 @@ def test_purge_not_allowed(self): def test_create_with_no_permissions(self): self.log("should be able to create a new Dataset without any permissions") - dataset = self.dataset_manager.create() + dataset = self.dataset_manager.create_for_unit_testing() permissions = self.dataset_manager.permissions.get(dataset) assert isinstance(permissions, tuple) @@ -125,7 +125,7 @@ def test_create_public_dataset(self): ) owner = self.user_manager.create(**user2_data) owner_private_role = self.user_manager.private_role(owner) - dataset = self.dataset_manager.create(manage_roles=[owner_private_role]) + dataset = self.dataset_manager.create_for_unit_testing(manage_roles=[owner_private_role]) permissions = self.dataset_manager.permissions.get(dataset) assert isinstance(permissions, tuple) @@ -157,7 +157,7 @@ def test_create_private_dataset(self): self.log("should be able to create a new Dataset and give it private permissions") owner = self.user_manager.create(**user2_data) owner_private_role = self.user_manager.private_role(owner) - dataset = self.dataset_manager.create(manage_roles=[owner_private_role], access_roles=[owner_private_role]) + dataset = self.dataset_manager.create_for_unit_testing(manage_roles=[owner_private_role], access_roles=[owner_private_role]) permissions = self.dataset_manager.permissions.get(dataset) assert isinstance(permissions, tuple) @@ -199,7 +199,7 @@ def set_up_managers(self): self.role_manager = RoleManager(self.app) def test_views(self): - dataset = self.dataset_manager.create() + dataset = self.dataset_manager.create_for_unit_testing() self.log("should have a summary view") summary_view = self.dataset_serializer.serialize_to_view(dataset, view="summary") @@ -217,7 +217,7 @@ def test_views(self): ), f"No serializer for: {key} ({instantiated_attribute})" def test_views_and_keys(self): - dataset = self.dataset_manager.create() + dataset = self.dataset_manager.create_for_unit_testing() self.log("should be able to use keys with views") serialized = self.dataset_serializer.serialize_to_view( @@ -233,7 +233,7 @@ def test_views_and_keys(self): self.assertKeys(serialized, ["purgable", "file_size"]) def test_serialize_permissions(self): - dataset = self.dataset_manager.create() + dataset = self.dataset_manager.create_for_unit_testing() who_manages = self.user_manager.create(**user2_data) self.dataset_manager.permissions.manage.grant(dataset, who_manages) @@ -268,7 +268,7 @@ def test_serialize_permissions(self): def test_serializers(self): # self.user_manager.create( **user2_data ) - dataset = self.dataset_manager.create() + dataset = self.dataset_manager.create_for_unit_testing() all_keys = list(self.dataset_serializer.serializable_keyset) serialized = self.dataset_serializer.serialize(dataset, all_keys)