Fixed issue #2412 - i-doit version >= 1.12 integration requests fail with 'Can’t fetch objects from...' due to missing payload attribute 'id'.

This commit is contained in:
Thorsten Eckel 2018-12-20 15:19:37 +01:00
parent 76dfdbaf83
commit 4044394139
2 changed files with 7 additions and 3 deletions

View file

@ -109,6 +109,10 @@ or with filter:
method: method,
params: params,
version: '2.0',
# the id attribute is required by the JSON-RPC standard
# but i-doit doesn't actually use it so we send a hard coded id
# see issue #2412 and community topic for further information
id: 42,
},
{
json: true,

View file

@ -44,7 +44,7 @@ RSpec.describe 'Idoit', type: :request do
expect(json_response['error']).to eq('Not authorized (user)!')
stub_request(:post, "#{endpoint}src/jsonrpc.php")
.with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\"}")
.with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\",\"id\":42}")
.to_return(status: 200, body: read_message('object_types_response'), headers: {})
params = {
@ -81,7 +81,7 @@ RSpec.describe 'Idoit', type: :request do
it 'does list all object types' do
stub_request(:post, "#{endpoint}src/jsonrpc.php")
.with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\"}")
.with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\",\"id\":42}")
.to_return(status: 200, body: read_message('object_types_response'), headers: {})
params = {
@ -121,7 +121,7 @@ RSpec.describe 'Idoit', type: :request do
it 'does query objects' do
stub_request(:post, "#{endpoint}src/jsonrpc.php")
.with(body: "{\"method\":\"cmdb.objects\",\"params\":{\"apikey\":\"#{token}\",\"filter\":{\"ids\":[\"33\"]}},\"version\":\"2.0\"}")
.with(body: "{\"method\":\"cmdb.objects\",\"params\":{\"apikey\":\"#{token}\",\"filter\":{\"ids\":[\"33\"]}},\"version\":\"2.0\",\"id\":42}")
.to_return(status: 200, body: read_message('object_types_filter_response'), headers: {})
params = {