Skip to content

Commit 2702602

Browse files
authored
Fix 3 tests providing users with Location scopes (#20371)
1 parent 8a612f7 commit 2702602

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

tests/foreman/api/test_contentview.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ def test_negative_readonly_user_actions(
23232323

23242324

23252325
def test_negative_non_readonly_user_actions(
2326-
target_sat, content_view, module_org, function_role_with_org
2326+
target_sat, content_view, module_org, function_role_with_org, default_location
23272327
):
23282328
"""Attempt to view content views
23292329
@@ -2356,6 +2356,7 @@ def test_negative_non_readonly_user_actions(
23562356
# create a user and assign the above created role
23572357
target_sat.api.User(
23582358
organization=[module_org],
2359+
location=[default_location],
23592360
role=[function_role_with_org],
23602361
login=user_login,
23612362
password=user_password,

tests/foreman/cli/test_contentview.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,7 +2952,9 @@ def test_negative_user_with_read_only_cv_permission(self, module_org, module_tar
29522952
{'organization-id': module_org.id}
29532953
)
29542954

2955-
def test_positive_user_with_all_cv_permissions(self, module_org, module_target_sat):
2955+
def test_positive_user_with_all_cv_permissions(
2956+
self, module_org, default_location, module_target_sat
2957+
):
29562958
"""A user with all content view permissions is able to create,
29572959
read, modify, promote, publish content views
29582960
@@ -2973,7 +2975,11 @@ def test_positive_user_with_all_cv_permissions(self, module_org, module_target_s
29732975
)
29742976
password = gen_string('alphanumeric')
29752977
user = module_target_sat.cli_factory.user(
2976-
{'password': password, 'organization-ids': module_org.id}
2978+
{
2979+
'password': password,
2980+
'organization-ids': module_org.id,
2981+
'location-ids': default_location.id,
2982+
}
29772983
)
29782984
role = module_target_sat.cli_factory.make_role({'organization-ids': module_org.id})
29792985
# note: the filters inherit role organizations

tests/foreman/cli/test_flatpak.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ def function_role(target_sat):
3737

3838

3939
@pytest.fixture
40-
def function_user(target_sat, function_role, function_org):
40+
def function_user(target_sat, function_role, function_org, default_location):
4141
"""Non-admin user with an empty role assigned."""
4242
password = gen_string('alphanumeric')
4343
user = target_sat.api.User(
4444
login=gen_string('alpha'),
4545
password=password,
4646
role=[function_role],
4747
organization=[function_org],
48+
location=[default_location],
4849
).create()
4950
user.password = password
5051
yield user

0 commit comments

Comments
 (0)