]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
create a new get_acl helper to ensure proper xml is compared
authorAlfredo Deza <adeza@redhat.com>
Wed, 11 Feb 2015 16:13:28 +0000 (11:13 -0500)
committerAlfredo Deza <adeza@redhat.com>
Wed, 11 Feb 2015 16:24:44 +0000 (11:24 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
tasks/radosgw_admin.py

index 9a51ac66b6d8b8d0bb4800fbb4389f02d671567b..d0d6c2139e6540c4137215260d671bf0b6b973fc 100644 (file)
@@ -52,6 +52,27 @@ def send_raw_http_request(conn, method, bucket_name, key_name, follow_redirects
     h.follow_redirects = follow_redirects
     return h.request(url, method)
 
+
+def get_acl(key):
+    """
+    Helper function to get the xml acl from a key, ensuring that the xml
+    version tag is removed from the acl response
+    """
+    raw_acl = key.get_xml_acl()
+
+    def remove_version(string):
+        return string.split(
+            '<?xml version="1.0" encoding="UTF-8"?>'
+        )[-1]
+
+    def remove_newlines(string):
+        return string.strip('\n')
+
+    return remove_version(
+        remove_newlines(raw_acl)
+    )
+
+
 def task(ctx, config):
     """
     Test radosgw-admin functionality against a running rgw instance.
@@ -920,7 +941,7 @@ def task(ctx, config):
         ['policy', '--bucket', bucket.name, '--object', key.key],
         check_status=True)
 
-    acl = key.get_xml_acl()
+    acl = get_acl(key)
 
     assert acl == out.strip('\n')
 
@@ -931,7 +952,8 @@ def task(ctx, config):
         ['policy', '--bucket', bucket.name, '--object', key.key],
         check_status=True)
 
-    acl = key.get_xml_acl()
+    acl = get_acl(key)
+
     assert acl == out.strip('\n')
 
     # TESTCASE 'rm-bucket', 'bucket', 'rm', 'bucket with objects', 'succeeds'