Esempio n. 1
0
 def test_qos_specs_get(self):
     request = self.mock_rest_request(GET={})
     qos_specs = self.cinder_qos_specs.list()
     self.mock_qos_specs_list.return_value = qos_specs
     response = cinder.QoSSpecs().get(request)
     self.assertStatusCode(response, 200)
     self.assertEqual([spec.to_dict() for spec in qos_specs],
                      response.json['items'])
     self.mock_qos_specs_list.assert_called_once_with(request)
 def test_qos_specs_get(self, cc):
     request = self.mock_rest_request(GET={})
     cc.qos_specs_list.return_value = [
         mock.Mock(**{'to_dict.return_value': {'id': 'one'}}),
         mock.Mock(**{'to_dict.return_value': {'id': 'two'}}),
     ]
     response = cinder.QoSSpecs().get(request)
     self.assertStatusCode(response, 200)
     self.assertEqual(response.content.decode("utf-8"),
                      '{"items": [{"id": "one"}, {"id": "two"}]}')
     cc.qos_specs_list.assert_called_once_with(request)