Merge "Fix problems about location header in resource2"

This commit is contained in:
Jenkins
2016-08-24 12:20:07 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 2 deletions

View File

@@ -219,7 +219,7 @@ class Resource(object):
#: The name of this resource.
name = Body("name")
#: The location of this resource.
location = Header("location")
location = Header("Location")
#: Mapping of accepted query parameter names.
_query_mapping = QueryParameters()

View File

@@ -382,7 +382,7 @@ class TestResource(base.TestCase):
def test_initialize_basic(self):
body = {"body": 1}
header = {"header": 2}
header = {"header": 2, "Location": "somewhere"}
uri = {"uri": 3}
everything = dict(itertools.chain(body.items(), header.items(),
uri.items()))
@@ -394,6 +394,7 @@ class TestResource(base.TestCase):
"_collect_attrs", mock_collect):
sot = resource2.Resource(synchronized=False, **everything)
mock_collect.assert_called_once_with(everything)
self.assertEqual("somewhere", sot.location)
self.assertIsInstance(sot._body, resource2._ComponentManager)
self.assertEqual(body, sot._body.dirty)