예제 #1
0
 def test_volume_type_get_metadata(self):
     request = self.mock_rest_request(**{'GET': {}})
     self.mock_volume_type_extra_get.return_value = \
         [VolTypeExtraSpec(1, 'foo', 'bar')]
     response = cinder.VolumeTypeMetadata().get(request, '1')
     self.assertStatusCode(response, 200)
     self.assertEqual(response.json, {'foo': 'bar'})
     self.mock_volume_type_extra_get.assert_called_once_with(request, '1')
예제 #2
0
 def test_volume_type_update_metadata(self, cc):
     request = self.mock_rest_request(
         body='{"updated": {"a": "1", "b": "2"}, '
         '"removed": ["c", "d"]}')
     response = cinder.VolumeTypeMetadata().patch(request, '1')
     self.assertStatusCode(response, 204)
     self.assertEqual(b'', response.content)
     cc.volume_type_extra_set.assert_called_once_with(
         request, '1', {
             'a': '1',
             'b': '2'
         })
     cc.volume_type_extra_delete.assert_called_once_with(
         request, '1', ['c', 'd'])