'Test attachment_create with connector.'

@mock.patch('cinder.volume.api.check_policy')
@mock.patch('cinder.volume.rpcapi.VolumeAPI.attachment_update')
def test_attachment_create_with_connector(self, mock_rpc_attachment_update, mock_policy):

    volume_params = {'status': 'available'}
    connection_info = {'fake_key': 'fake_value', 'fake_key2': ['fake_value1', 'fake_value2']}
    mock_rpc_attachment_update.return_value = connection_info
    vref = tests_utils.create_volume(self.context, **volume_params)
    connector = {'fake': 'connector'}
    attachment = self.volume_api.attachment_create(self.context, vref, fake.UUID2, connector)
    mock_rpc_attachment_update.assert_called_once_with(self.context, mock.ANY, connector, mock.ANY)
    new_attachment = objects.VolumeAttachment.get_by_id(self.context, attachment.id)
    self.assertEqual(connection_info, new_attachment.connection_info)
