Merge "Fix delete attribute api bug"
This commit is contained in:
commit
31b8cc3c84
@ -163,4 +163,5 @@ class AttributesController(base.CyborgController,
|
|||||||
"""
|
"""
|
||||||
LOG.info('[attributes] delete by uuid: %s.', uuid)
|
LOG.info('[attributes] delete by uuid: %s.', uuid)
|
||||||
context = pecan.request.context
|
context = pecan.request.context
|
||||||
objects.Attribute.destroy(context, uuid)
|
api_obj_attribute = objects.Attribute.get(context, uuid)
|
||||||
|
api_obj_attribute.destroy(context)
|
||||||
|
@ -114,8 +114,9 @@ class TestAttributes(v2_test.APITestV2):
|
|||||||
for in_attribute, out_attribute in zip(attributes, out_attributes):
|
for in_attribute, out_attribute in zip(attributes, out_attributes):
|
||||||
self._validate_attributes(in_attribute, out_attribute)
|
self._validate_attributes(in_attribute, out_attribute)
|
||||||
|
|
||||||
|
@mock.patch('cyborg.objects.Attribute.get')
|
||||||
@mock.patch('cyborg.objects.Attribute.destroy')
|
@mock.patch('cyborg.objects.Attribute.destroy')
|
||||||
def test_delete(self, mock_attribute_uuid):
|
def test_delete(self, mock_attribute_delete, mock_attribute):
|
||||||
uuid = self.fake_attribute_objs[0]['uuid']
|
uuid = self.fake_attribute_objs[0]['uuid']
|
||||||
# Delete by UUID
|
# Delete by UUID
|
||||||
url = self.ATTRIBUTE_URL + '/%s' % uuid
|
url = self.ATTRIBUTE_URL + '/%s' % uuid
|
||||||
|
Loading…
Reference in New Issue
Block a user