def test_volume_get(self, cc):
     request = self.mock_rest_request(**{'GET': {}})
     cc.volume_get.return_value = mock.Mock(
         **{'to_dict.return_value': {'id': 'one'}})
     response = cinder.Volume().get(request, '1')
     self.assertStatusCode(response, 200)
     self.assertEqual(response.json, {"id": "one"})
     cc.volume_get.assert_called_once_with(request, '1')
示例#2
0
    def test_volume_get(self):
        request = self.mock_rest_request(**{'GET': {}})
        vol = self.cinder_volumes.first()
        self.mock_volume_get.return_value = vol

        response = cinder.Volume().get(request, '1')

        self.assertStatusCode(response, 200)
        self.assertEqual(vol.to_dict(), response.json)
        self.mock_volume_get.assert_called_once_with(request, '1')