Merge "Use single quotes in image policies"
This commit is contained in:
commit
46fb37112c
glance
@ -26,12 +26,12 @@ PROJECT_READER = 'role:reader and project_id:%(project_id)s'
|
|||||||
IMAGE_MEMBER_CHECK = 'project_id:%(member_id)s'
|
IMAGE_MEMBER_CHECK = 'project_id:%(member_id)s'
|
||||||
# Check if the visibility of the image supplied in the target matches
|
# Check if the visibility of the image supplied in the target matches
|
||||||
# "community"
|
# "community"
|
||||||
COMMUNITY_VISIBILITY_CHECK = '"community":%(visibility)s'
|
COMMUNITY_VISIBILITY_CHECK = "'community':%(visibility)s"
|
||||||
# Check if the visibility of the resource supplied in the target matches
|
# Check if the visibility of the resource supplied in the target matches
|
||||||
# "public"
|
# "public"
|
||||||
PUBLIC_VISIBILITY_CHECK = '"public":%(visibility)s'
|
PUBLIC_VISIBILITY_CHECK = "'public':%(visibility)s"
|
||||||
# Check if the visibility of the image supplied in the target matches "shared"
|
# Check if the visibility of the image supplied in the target matches "shared"
|
||||||
SHARED_VISIBILITY_CHECK = '"shared":%(visibility)s'
|
SHARED_VISIBILITY_CHECK = "'shared':%(visibility)s"
|
||||||
|
|
||||||
PROJECT_MEMBER_OR_IMAGE_MEMBER_OR_COMMUNITY_OR_PUBLIC_OR_SHARED = (
|
PROJECT_MEMBER_OR_IMAGE_MEMBER_OR_COMMUNITY_OR_PUBLIC_OR_SHARED = (
|
||||||
f'role:member and (project_id:%(project_id)s or {IMAGE_MEMBER_CHECK} '
|
f'role:member and (project_id:%(project_id)s or {IMAGE_MEMBER_CHECK} '
|
||||||
|
@ -1088,9 +1088,9 @@ class TestDefaultPolicyCheckStrings(base.IsolatedUnitTest):
|
|||||||
|
|
||||||
def test_project_member_download_image_check_string(self):
|
def test_project_member_download_image_check_string(self):
|
||||||
expected = (
|
expected = (
|
||||||
'role:member and (project_id:%(project_id)s or '
|
"role:member and (project_id:%(project_id)s or "
|
||||||
'project_id:%(member_id)s or "community":%(visibility)s or '
|
"project_id:%(member_id)s or 'community':%(visibility)s or "
|
||||||
'"public":%(visibility)s or "shared":%(visibility)s)'
|
"'public':%(visibility)s or 'shared':%(visibility)s)"
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected,
|
expected,
|
||||||
@ -1108,9 +1108,9 @@ class TestDefaultPolicyCheckStrings(base.IsolatedUnitTest):
|
|||||||
|
|
||||||
def test_project_reader_get_image_check_string(self):
|
def test_project_reader_get_image_check_string(self):
|
||||||
expected = (
|
expected = (
|
||||||
'role:reader and (project_id:%(project_id)s or '
|
"role:reader and (project_id:%(project_id)s or "
|
||||||
'project_id:%(member_id)s or "community":%(visibility)s or '
|
"project_id:%(member_id)s or \'community\':%(visibility)s or "
|
||||||
'"public":%(visibility)s or "shared":%(visibility)s)'
|
"'public':%(visibility)s or 'shared':%(visibility)s)"
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected,
|
expected,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user