Satisfy API Reference documentation deleting tags
The API Reference documentation for Glance v2 documents the response status code for the metadefs delete-tags call as 204, but instead that call returns a 200 status code. This patch fixes the disparity and adds the ability to start testing our response serializer. This patch changes the response code instead of the documentation because 204 (No Content) is the correct response for this call and because all the other metadefs DELETE calls return 204. So to preserve consistency and to honor the published contract, this patch changes the code, not the documentation. This patch was discussed with the API-WG (on 2 Feb 2017) and the TC (on 14 Feb 2017), and they both endorse this approach. See the meeting logs for details. Closes-bug: #1656183 Depends-On: I84626976ca729f65b0ee0ea6afe5c9a6a408eecc Change-Id: I4b6dc1714aeca409a85bfa1f9b729147da704df8
This commit is contained in:
parent
eeaaa42fd7
commit
529dc665a0
@ -549,6 +549,9 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
|
||||
def delete_properties(self, response, result):
|
||||
response.status_int = http.NO_CONTENT
|
||||
|
||||
def delete_tags(self, response, result):
|
||||
response.status_int = http.NO_CONTENT
|
||||
|
||||
def __render(self, json_data, response, response_status=None):
|
||||
body = jsonutils.dumps(json_data, ensure_ascii=False)
|
||||
response.unicode_body = six.text_type(body)
|
||||
|
@ -2064,3 +2064,16 @@ class TestMetadefsControllers(base.IsolatedUnitTest):
|
||||
self.tag_controller.update, request, tag,
|
||||
NAMESPACE4, TAG1)
|
||||
self.assertNotificationsLog([])
|
||||
|
||||
|
||||
class TestMetadefNamespaceResponseSerializers(base.IsolatedUnitTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestMetadefNamespaceResponseSerializers, self).setUp()
|
||||
self.serializer = namespaces.ResponseSerializer(schema={})
|
||||
self.response = mock.Mock()
|
||||
self.result = mock.Mock()
|
||||
|
||||
def test_delete_tags(self):
|
||||
self.serializer.delete_tags(self.response, self.result)
|
||||
self.assertEqual(204, self.response.status_int)
|
||||
|
Loading…
Reference in New Issue
Block a user