Relax bucket creation schema

Apparently some AWS-supplied tools use undocumented root elements.

Change-Id: I3d56f9560c2d96b08e6837d053fdff654c531062
Closes-Bug: #1611749
This commit is contained in:
Tim Burke 2016-12-29 00:59:09 +00:00
parent 1d8d305b57
commit 0a2bfb8bae
3 changed files with 19 additions and 5 deletions

View File

@ -1,4 +1,4 @@
start =
element CreateBucketConfiguration {
element * {
element LocationConstraint { xsd:string }
}

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="CreateBucketConfiguration">
<element>
<anyName/>
<element name="LocationConstraint">
<data type="string"/>
</element>

View File

@ -363,9 +363,8 @@ class TestSwift3Bucket(Swift3TestCase):
self.assertEqual(status.split()[0], '200')
self.assertEqual(headers['Location'], '/bucket')
@s3acl
def test_bucket_PUT_with_location(self):
elem = Element('CreateBucketConfiguration')
def _test_bucket_PUT_with_location(self, root_element):
elem = Element(root_element)
SubElement(elem, 'LocationConstraint').text = 'US'
xml = tostring(elem)
@ -377,6 +376,20 @@ class TestSwift3Bucket(Swift3TestCase):
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '200')
@s3acl
def test_bucket_PUT_with_location(self):
self._test_bucket_PUT_with_location('CreateBucketConfiguration')
@s3acl
def test_bucket_PUT_with_ami_location(self):
# ec2-ami-tools apparently uses CreateBucketConstraint instead?
self._test_bucket_PUT_with_location('CreateBucketConstraint')
@s3acl
def test_bucket_PUT_with_strange_location(self):
# Even crazier: it doesn't seem to matter
self._test_bucket_PUT_with_location('foo')
def test_bucket_PUT_with_canned_acl(self):
req = Request.blank('/bucket',
environ={'REQUEST_METHOD': 'PUT'},