예제 #1
0
 def test_share_type_not_found_by_name(self):
     # verify response code for exception.ShareTypeNotFoundByName
     share_type_name = "fake_share_type_name"
     e = exception.ShareTypeNotFoundByName(
         share_type_name=share_type_name)
     self.assertEqual(404, e.code)
     self.assertIn(share_type_name, e.msg)
예제 #2
0
 def test_share_create_with_invalid_default_share_type(self):
     self.mock_object(
         share_types, 'get_default_share_type',
         mock.Mock(side_effect=exception.ShareTypeNotFoundByName(
             self.vt['name'])),
     )
     CONF.set_default("default_share_type", self.vt['name'])
     req = fakes.HTTPRequest.blank('/shares')
     self.assertRaises(exception.ShareTypeNotFoundByName,
                       self.controller.create, req, {'share': self.share})
     share_types.get_default_share_type.assert_called_once_with()
예제 #3
0
    def test_share_manage_share_type_not_found(self):
        body = get_fake_manage_body()
        self.mock_object(db_api, 'service_get_by_host_and_topic', mock.Mock())
        self.mock_object(utils, 'service_is_up', mock.Mock(return_value=True))
        self.mock_object(
            db_api, 'share_type_get_by_name',
            mock.Mock(side_effect=exception.ShareTypeNotFoundByName(
                share_type_name='fake')))

        self.assertRaises(webob.exc.HTTPNotFound, self.controller.create,
                          self.request, body)
예제 #4
0
def return_share_types_destroy(context, name):
    if name == "777":
        raise exception.ShareTypeNotFoundByName(share_type_name=name)
    pass
예제 #5
0
def return_share_types_get_by_name(context, name):
    if name == "777":
        raise exception.ShareTypeNotFoundByName(share_type_name=name)
    return stub_share_type(int(name.split("_")[2]))