"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/tests/api/v1/test_share_manage.py" between
manila-11.0.0.tar.gz and manila-11.0.1.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Victoria" series (latest release).

test_share_manage.py  (manila-11.0.0):test_share_manage.py  (manila-11.0.1)
skipping to change at line 61 skipping to change at line 61
use_admin_context=True) use_admin_context=True)
self.context = self.request.environ['manila.context'] self.context = self.request.environ['manila.context']
self.mock_policy_check = self.mock_object( self.mock_policy_check = self.mock_object(
policy, 'check_policy', mock.Mock(return_value=True)) policy, 'check_policy', mock.Mock(return_value=True))
self.mock_object( self.mock_object(
common, 'validate_public_share_policy', common, 'validate_public_share_policy',
mock.Mock(side_effect=lambda *args, **kwargs: args[1])) mock.Mock(side_effect=lambda *args, **kwargs: args[1]))
@ddt.data({}, @ddt.data({},
{'shares': {}}, {'shares': {}},
{'share': get_fake_manage_body('', None, None)}) {'share': get_fake_manage_body('', None, None)},
{'share': get_fake_manage_body(
export_path={'not_path': '/fake'})})
def test_share_manage_invalid_body(self, body): def test_share_manage_invalid_body(self, body):
self.assertRaises(webob.exc.HTTPUnprocessableEntity, self.assertRaises(webob.exc.HTTPUnprocessableEntity,
self.controller.create, self.controller.create,
self.request, self.request,
body) body)
self.mock_policy_check.assert_called_once_with( self.mock_policy_check.assert_called_once_with(
self.context, self.resource_name, 'manage') self.context, self.resource_name, 'manage')
def test_share_manage_service_not_found(self): def test_share_manage_service_not_found(self):
body = get_fake_manage_body() body = get_fake_manage_body()
skipping to change at line 193 skipping to change at line 195
self.mock_policy_check.assert_called_once_with( self.mock_policy_check.assert_called_once_with(
self.context, self.resource_name, 'manage') self.context, self.resource_name, 'manage')
@ddt.data( @ddt.data(
get_fake_manage_body(name='foo', description='bar'), get_fake_manage_body(name='foo', description='bar'),
get_fake_manage_body(display_name='foo', description='bar'), get_fake_manage_body(display_name='foo', description='bar'),
get_fake_manage_body(name='foo', display_description='bar'), get_fake_manage_body(name='foo', display_description='bar'),
get_fake_manage_body(display_name='foo', display_description='bar'), get_fake_manage_body(display_name='foo', display_description='bar'),
get_fake_manage_body(display_name='foo', display_description='bar', get_fake_manage_body(display_name='foo', display_description='bar',
driver_options=dict(volume_id='quuz')), driver_options=dict(volume_id='quuz')),
get_fake_manage_body(display_name='foo', display_description='bar',
export_path={'path': '/fake'}),
) )
def test_share_manage(self, data): def test_share_manage(self, data):
self._setup_manage_mocks() self._setup_manage_mocks()
return_share = {'share_type_id': '', 'id': 'fake'} return_share = {'share_type_id': '', 'id': 'fake'}
self.mock_object( self.mock_object(
share_api.API, 'manage', mock.Mock(return_value=return_share)) share_api.API, 'manage', mock.Mock(return_value=return_share))
share = { share = {
'host': data['share']['service_host'], 'host': data['share']['service_host'],
'export_location': data['share']['export_path'], 'export_location_path': data['share']['export_path'],
'share_proto': data['share']['protocol'].upper(), 'share_proto': data['share']['protocol'].upper(),
'share_type_id': 'fake', 'share_type_id': 'fake',
'display_name': 'foo', 'display_name': 'foo',
'display_description': 'bar', 'display_description': 'bar',
} }
data['share']['is_public'] = 'foo' data['share']['is_public'] = 'foo'
driver_options = data['share'].get('driver_options', {}) driver_options = data['share'].get('driver_options', {})
if isinstance(share['export_location_path'], dict):
share['export_location_path'] = (
share['export_location_path']['path']
)
actual_result = self.controller.create(self.request, data) actual_result = self.controller.create(self.request, data)
share_api.API.manage.assert_called_once_with( share_api.API.manage.assert_called_once_with(
mock.ANY, share, driver_options) mock.ANY, share, driver_options)
self.assertIsNotNone(actual_result) self.assertIsNotNone(actual_result)
self.mock_policy_check.assert_called_once_with( self.mock_policy_check.assert_called_once_with(
self.context, self.resource_name, 'manage') self.context, self.resource_name, 'manage')
def test_share_manage_allow_dhss_true(self): def test_share_manage_allow_dhss_true(self):
self._setup_manage_mocks() self._setup_manage_mocks()
data = get_fake_manage_body(name='foo', description='bar') data = get_fake_manage_body(name='foo', description='bar')
return_share = {'share_type_id': '', 'id': 'fake'} return_share = {'share_type_id': '', 'id': 'fake'}
self.mock_object( self.mock_object(
share_api.API, 'manage', mock.Mock(return_value=return_share)) share_api.API, 'manage', mock.Mock(return_value=return_share))
share = { share = {
'host': data['share']['service_host'], 'host': data['share']['service_host'],
'export_location': data['share']['export_path'], 'export_location_path': data['share']['export_path'],
'share_proto': data['share']['protocol'].upper(), 'share_proto': data['share']['protocol'].upper(),
'share_type_id': 'fake', 'share_type_id': 'fake',
'display_name': 'foo', 'display_name': 'foo',
'display_description': 'bar', 'display_description': 'bar',
'share_server_id': 'fake' 'share_server_id': 'fake'
} }
data['share']['share_server_id'] = 'fake' data['share']['share_server_id'] = 'fake'
driver_options = data['share'].get('driver_options', {}) driver_options = data['share'].get('driver_options', {})
self.controller._manage(self.request, data, allow_dhss_true=True) self.controller._manage(self.request, data, allow_dhss_true=True)
 End of changes. 5 change blocks. 
3 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)