Exemplo n.º 1
0
    def test_create_cg_does_not_a_uuid(self):
        self.mock_object(
            self.controller.cg_api, 'create_cgsnapshot',
            mock.Mock(side_effect=exception.ConsistencyGroupNotFound(
                consistency_group_id='not_a_uuid')))

        body = {"cgsnapshot": {"consistency_group_id": "not_a_uuid"}}
        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
                          self.request, body)
Exemplo n.º 2
0
    def test_create_cg_does_not_exist(self):
        fake_id = six.text_type(uuid.uuid4())
        self.mock_object(
            self.controller.cg_api, 'create_cgsnapshot',
            mock.Mock(side_effect=exception.ConsistencyGroupNotFound(
                consistency_group_id=six.text_type(uuid.uuid4()))))

        body = {"cgsnapshot": {"consistency_group_id": fake_id}}
        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
                          self.request, body)
Exemplo n.º 3
0
    def test_create_cg_does_not_exist(self):
        fake_id = six.text_type(uuidutils.generate_uuid())
        self.mock_object(
            self.controller.cg_api, 'create_cgsnapshot',
            mock.Mock(side_effect=exception.ConsistencyGroupNotFound(
                consistency_group_id=six.text_type(
                    uuidutils.generate_uuid()))))

        body = {"cgsnapshot": {"consistency_group_id": fake_id}}
        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
                          self.request, body)
        self.mock_policy_check.assert_called_once_with(self.context,
                                                       self.resource_name,
                                                       'create')