diff --git a/test/unit/data/model/conftest.py b/test/unit/data/model/conftest.py index a3daec99bc2e..a10f10cb00ce 100644 --- a/test/unit/data/model/conftest.py +++ b/test/unit/data/model/conftest.py @@ -428,6 +428,24 @@ def f(**kwd): return f +@pytest.fixture +def make_user_and_role(session, make_user, make_role, make_user_role_association): + """ + Each user created in Galaxy is assumed to have a private role, such that role.type == Role.types.PRIVATE. + Since we are testing user/group/role associations here, to ensure the correct state of the test database, + we need to ensure that a user is never created without a corresponding private role. + Therefore, we use this fixture instead of make_user (which only creates a user). + """ + + def f(**kwd): + user = make_user(**kwd) + private_role = make_role(type=m.Role.types.PRIVATE) + make_user_role_association(user, private_role) + return user, private_role + + return f + + @pytest.fixture def make_user_item_rating_association(session): def f(assoc_class, user, item, rating): diff --git a/test/unit/data/model/db/test_security.py b/test/unit/data/model/db/test_security.py index 13c6aa9419fe..a255e408048b 100644 --- a/test/unit/data/model/db/test_security.py +++ b/test/unit/data/model/db/test_security.py @@ -10,24 +10,6 @@ from . import have_same_elements -@pytest.fixture -def make_user_and_role(session, make_user, make_role, make_user_role_association): - """ - Each user created in Galaxy is assumed to have a private role, such that role.type == Role.types.PRIVATE. - Since we are testing user/group/role associations here, to ensure the correct state of the test database, - we need to ensure that a user is never created without a corresponding private role. - Therefore, we use this fixture instead of make_user (which only creates a user). - """ - - def f(**kwd): - user = make_user() - private_role = make_role(type=Role.types.PRIVATE) - make_user_role_association(user, private_role) - return user, private_role - - return f - - def test_private_user_role_assoc_not_affected_by_setting_user_roles(session, make_user_and_role): # Create user with a private role user, private_role = make_user_and_role()