@itentialopensource/adapter-centreon 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +199 -0
  6. package/CALLS.md +170 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +172 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +641 -0
  13. package/README.md +337 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +11 -0
  16. package/TROUBLESHOOT.md +47 -0
  17. package/adapter.js +13198 -0
  18. package/adapterBase.js +1787 -0
  19. package/entities/.generic/action.json +214 -0
  20. package/entities/.generic/schema.json +28 -0
  21. package/entities/.system/action.json +50 -0
  22. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  23. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  24. package/entities/.system/schema.json +19 -0
  25. package/entities/.system/schemaTokenReq.json +53 -0
  26. package/entities/.system/schemaTokenResp.json +53 -0
  27. package/entities/AccessControl/action.json +25 -0
  28. package/entities/AccessControl/schema.json +19 -0
  29. package/entities/Acknowledgement/action.json +351 -0
  30. package/entities/Acknowledgement/schema.json +90 -0
  31. package/entities/Administration/action.json +290 -0
  32. package/entities/Administration/mockdatafiles/listonevaultconfigurationbyitsid-default.json +9 -0
  33. package/entities/Administration/schema.json +54 -0
  34. package/entities/Authentication/action.json +126 -0
  35. package/entities/Authentication/mockdatafiles/providersConfigurations-default.json +26 -0
  36. package/entities/Authentication/schema.json +35 -0
  37. package/entities/Check/action.json +124 -0
  38. package/entities/Check/schema.json +57 -0
  39. package/entities/Comment/action.json +24 -0
  40. package/entities/Comment/schema.json +19 -0
  41. package/entities/Downtime/action.json +291 -0
  42. package/entities/Downtime/schema.json +98 -0
  43. package/entities/Gorgone/action.json +45 -0
  44. package/entities/Gorgone/mockdatafiles/gorgonepollerresponsestoken-default.json +398 -0
  45. package/entities/Gorgone/schema.json +42 -0
  46. package/entities/Host/action.json +46 -0
  47. package/entities/Host/schema.json +53 -0
  48. package/entities/HostCategory/action.json +106 -0
  49. package/entities/HostCategory/schema.json +45 -0
  50. package/entities/HostGroup/action.json +107 -0
  51. package/entities/HostGroup/schema.json +78 -0
  52. package/entities/HostSeverity/action.json +65 -0
  53. package/entities/HostSeverity/schema.json +32 -0
  54. package/entities/HostTemplate/action.json +25 -0
  55. package/entities/HostTemplate/schema.json +19 -0
  56. package/entities/Icons/action.json +25 -0
  57. package/entities/Icons/schema.json +19 -0
  58. package/entities/MetaService/action.json +67 -0
  59. package/entities/MetaService/schema.json +43 -0
  60. package/entities/Metrics/action.json +109 -0
  61. package/entities/Metrics/schema.json +56 -0
  62. package/entities/MonitoringServer/action.json +172 -0
  63. package/entities/MonitoringServer/schema.json +48 -0
  64. package/entities/NotificationPolicy/action.json +67 -0
  65. package/entities/NotificationPolicy/schema.json +54 -0
  66. package/entities/Platform/action.json +86 -0
  67. package/entities/Platform/schema.json +22 -0
  68. package/entities/Proxy/action.json +45 -0
  69. package/entities/Proxy/schema.json +20 -0
  70. package/entities/Resource/action.json +67 -0
  71. package/entities/Resource/schema.json +164 -0
  72. package/entities/Service/action.json +67 -0
  73. package/entities/Service/schema.json +54 -0
  74. package/entities/ServiceCategory/action.json +66 -0
  75. package/entities/ServiceCategory/schema.json +21 -0
  76. package/entities/ServiceGroup/action.json +107 -0
  77. package/entities/ServiceGroup/schema.json +89 -0
  78. package/entities/ServiceSeverity/action.json +65 -0
  79. package/entities/ServiceSeverity/schema.json +32 -0
  80. package/entities/Severity/action.json +46 -0
  81. package/entities/Severity/schema.json +31 -0
  82. package/entities/Submit/action.json +84 -0
  83. package/entities/Submit/schema.json +55 -0
  84. package/entities/TimePeriod/action.json +106 -0
  85. package/entities/TimePeriod/schema.json +23 -0
  86. package/entities/Timeline/action.json +46 -0
  87. package/entities/Timeline/schema.json +53 -0
  88. package/entities/Topology/action.json +65 -0
  89. package/entities/Topology/schema.json +32 -0
  90. package/entities/User/action.json +171 -0
  91. package/entities/User/schema.json +48 -0
  92. package/entities/UserFilters/action.json +84 -0
  93. package/entities/UserFilters/schema.json +44 -0
  94. package/error.json +190 -0
  95. package/package.json +87 -0
  96. package/pronghorn.json +9146 -0
  97. package/propertiesDecorators.json +14 -0
  98. package/propertiesSchema.json +1248 -0
  99. package/refs?service=git-upload-pack +0 -0
  100. package/report/Centreon Monitoring tool.yml-OpenApi3Json.json +20770 -0
  101. package/report/creationReport.json +1400 -0
  102. package/sampleProperties.json +195 -0
  103. package/test/integration/adapterTestBasicGet.js +83 -0
  104. package/test/integration/adapterTestConnectivity.js +93 -0
  105. package/test/integration/adapterTestIntegration.js +4456 -0
  106. package/test/unit/adapterBaseTestUnit.js +949 -0
  107. package/test/unit/adapterTestUnit.js +5654 -0
  108. package/utils/adapterInfo.js +206 -0
  109. package/utils/addAuth.js +94 -0
  110. package/utils/artifactize.js +146 -0
  111. package/utils/basicGet.js +50 -0
  112. package/utils/checkMigrate.js +63 -0
  113. package/utils/entitiesToDB.js +178 -0
  114. package/utils/findPath.js +74 -0
  115. package/utils/methodDocumentor.js +225 -0
  116. package/utils/modify.js +154 -0
  117. package/utils/packModificationScript.js +35 -0
  118. package/utils/patches2bundledDeps.js +90 -0
  119. package/utils/pre-commit.sh +32 -0
  120. package/utils/removeHooks.js +20 -0
  121. package/utils/setup.js +33 -0
  122. package/utils/tbScript.js +246 -0
  123. package/utils/tbUtils.js +490 -0
  124. package/utils/testRunner.js +298 -0
  125. package/utils/troubleshootingAdapter.js +195 -0
  126. package/workflows/README.md +3 -0
@@ -0,0 +1,4456 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ // Set globals
4
+ /* global describe it log pronghornProps */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
8
+
9
+ // include required items for testing & logging
10
+ const assert = require('assert');
11
+ const fs = require('fs');
12
+ const mocha = require('mocha');
13
+ const path = require('path');
14
+ const winston = require('winston');
15
+ const { expect } = require('chai');
16
+ const { use } = require('chai');
17
+ const td = require('testdouble');
18
+ const util = require('util');
19
+
20
+ const anything = td.matchers.anything();
21
+
22
+ // stub and attemptTimeout are used throughout the code so set them here
23
+ let logLevel = 'none';
24
+ const isRapidFail = false;
25
+ const isSaveMockData = false;
26
+
27
+ // read in the properties from the sampleProperties files
28
+ let adaptdir = __dirname;
29
+ if (adaptdir.endsWith('/test/integration')) {
30
+ adaptdir = adaptdir.substring(0, adaptdir.length - 17);
31
+ } else if (adaptdir.endsWith('/test/unit')) {
32
+ adaptdir = adaptdir.substring(0, adaptdir.length - 10);
33
+ }
34
+ const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
35
+
36
+ // these variables can be changed to run in integrated mode so easier to set them here
37
+ // always check these in with bogus data!!!
38
+ samProps.stub = true;
39
+ samProps.host = 'replace.hostorip.here';
40
+ samProps.authentication.username = 'username';
41
+ samProps.authentication.password = 'password';
42
+ samProps.protocol = 'http';
43
+ samProps.port = 80;
44
+ samProps.ssl.enabled = false;
45
+ samProps.ssl.accept_invalid_cert = false;
46
+ if (samProps.request.attempt_timeout < 30000) {
47
+ samProps.request.attempt_timeout = 30000;
48
+ }
49
+ const attemptTimeout = samProps.request.attempt_timeout;
50
+ const { stub } = samProps;
51
+
52
+ // these are the adapter properties. You generally should not need to alter
53
+ // any of these after they are initially set up
54
+ global.pronghornProps = {
55
+ pathProps: {
56
+ encrypted: false
57
+ },
58
+ adapterProps: {
59
+ adapters: [{
60
+ id: 'Test-centreon',
61
+ type: 'Centreon',
62
+ properties: samProps
63
+ }]
64
+ }
65
+ };
66
+
67
+ global.$HOME = `${__dirname}/../..`;
68
+
69
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
70
+ // this you may error on log.trace calls.
71
+ const myCustomLevels = {
72
+ levels: {
73
+ spam: 6,
74
+ trace: 5,
75
+ debug: 4,
76
+ info: 3,
77
+ warn: 2,
78
+ error: 1,
79
+ none: 0
80
+ }
81
+ };
82
+
83
+ // need to see if there is a log level passed in
84
+ process.argv.forEach((val) => {
85
+ // is there a log level defined to be passed in?
86
+ if (val.indexOf('--LOG') === 0) {
87
+ // get the desired log level
88
+ const inputVal = val.split('=')[1];
89
+
90
+ // validate the log level is supported, if so set it
91
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
92
+ logLevel = inputVal;
93
+ }
94
+ }
95
+ });
96
+
97
+ // need to set global logging
98
+ global.log = winston.createLogger({
99
+ level: logLevel,
100
+ levels: myCustomLevels.levels,
101
+ transports: [
102
+ new winston.transports.Console()
103
+ ]
104
+ });
105
+
106
+ /**
107
+ * Runs the common asserts for test
108
+ */
109
+ function runCommonAsserts(data, error) {
110
+ assert.equal(undefined, error);
111
+ assert.notEqual(undefined, data);
112
+ assert.notEqual(null, data);
113
+ assert.notEqual(undefined, data.response);
114
+ assert.notEqual(null, data.response);
115
+ }
116
+
117
+ /**
118
+ * Runs the error asserts for the test
119
+ */
120
+ function runErrorAsserts(data, error, code, origin, displayStr) {
121
+ assert.equal(null, data);
122
+ assert.notEqual(undefined, error);
123
+ assert.notEqual(null, error);
124
+ assert.notEqual(undefined, error.IAPerror);
125
+ assert.notEqual(null, error.IAPerror);
126
+ assert.notEqual(undefined, error.IAPerror.displayString);
127
+ assert.notEqual(null, error.IAPerror.displayString);
128
+ assert.equal(code, error.icode);
129
+ assert.equal(origin, error.IAPerror.origin);
130
+ assert.equal(displayStr, error.IAPerror.displayString);
131
+ }
132
+
133
+ /**
134
+ * @function saveMockData
135
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
136
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
137
+ * @param {string} entityName - Name of the entity saving mock data for
138
+ * @param {string} actionName - Name of the action saving mock data for
139
+ * @param {string} descriptor - Something to describe this test (used as a type)
140
+ * @param {string or object} responseData - The data to put in the mock file.
141
+ */
142
+ function saveMockData(entityName, actionName, descriptor, responseData) {
143
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
144
+ if (stub || !isSaveMockData) {
145
+ return false;
146
+ }
147
+
148
+ // must have a response in order to store the response
149
+ if (responseData && responseData.response) {
150
+ let data = responseData.response;
151
+
152
+ // if there was a raw response that one is better as it is untranslated
153
+ if (responseData.raw) {
154
+ data = responseData.raw;
155
+
156
+ try {
157
+ const temp = JSON.parse(data);
158
+ data = temp;
159
+ } catch (pex) {
160
+ // do not care if it did not parse as we will just use data
161
+ }
162
+ }
163
+
164
+ try {
165
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
166
+ const mockdatafolder = 'mockdatafiles';
167
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
168
+
169
+ if (!fs.existsSync(base + mockdatafolder)) {
170
+ fs.mkdirSync(base + mockdatafolder);
171
+ }
172
+
173
+ // write the data we retrieved
174
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
175
+ if (errWritingMock) throw errWritingMock;
176
+
177
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
178
+ fs.readFile(`${base}action.json`, (errRead, content) => {
179
+ if (errRead) throw errRead;
180
+
181
+ // parse the action file into JSON
182
+ const parsedJson = JSON.parse(content);
183
+
184
+ // The object update we'll write in.
185
+ const responseObj = {
186
+ type: descriptor,
187
+ key: '',
188
+ mockFile: filename
189
+ };
190
+
191
+ // get the object for method we're trying to change.
192
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
193
+
194
+ // if the method was not found - should never happen but...
195
+ if (!currentMethodAction) {
196
+ throw Error('Can\'t find an action for this method in the provided entity.');
197
+ }
198
+
199
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
200
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
201
+
202
+ // Add the action responseObj back into the array of response objects.
203
+ if (!actionResponseObj) {
204
+ // if there is a default response object, we want to get the key.
205
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
206
+
207
+ // save the default key into the new response object
208
+ if (defaultResponseObj) {
209
+ responseObj.key = defaultResponseObj.key;
210
+ }
211
+
212
+ // save the new response object
213
+ currentMethodAction.responseObjects = [responseObj];
214
+ } else {
215
+ // update the location of the mock data file
216
+ actionResponseObj.mockFile = responseObj.mockFile;
217
+ }
218
+
219
+ // Save results
220
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
221
+ if (err) throw err;
222
+ });
223
+ });
224
+ });
225
+ } catch (e) {
226
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
227
+ return false;
228
+ }
229
+ }
230
+
231
+ // no response to save
232
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
233
+ return false;
234
+ }
235
+
236
+ // require the adapter that we are going to be using
237
+ const Centreon = require('../../adapter');
238
+
239
+ // begin the testing - these should be pretty well defined between the describe and the it!
240
+ describe('[integration] Centreon Adapter Test', () => {
241
+ describe('Centreon Class Tests', () => {
242
+ const a = new Centreon(
243
+ pronghornProps.adapterProps.adapters[0].id,
244
+ pronghornProps.adapterProps.adapters[0].properties
245
+ );
246
+
247
+ if (isRapidFail) {
248
+ const state = {};
249
+ state.passed = true;
250
+
251
+ mocha.afterEach(function x() {
252
+ state.passed = state.passed
253
+ && (this.currentTest.state === 'passed');
254
+ });
255
+ mocha.beforeEach(function x() {
256
+ if (!state.passed) {
257
+ return this.currentTest.skip();
258
+ }
259
+ return true;
260
+ });
261
+ }
262
+
263
+ describe('#class instance created', () => {
264
+ it('should be a class with properties', (done) => {
265
+ try {
266
+ assert.notEqual(null, a);
267
+ assert.notEqual(undefined, a);
268
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
269
+ assert.equal(checkId, a.id);
270
+ assert.notEqual(null, a.allProps);
271
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
272
+ assert.equal(check, a.healthcheckType);
273
+ done();
274
+ } catch (error) {
275
+ log.error(`Test Failure: ${error}`);
276
+ done(error);
277
+ }
278
+ }).timeout(attemptTimeout);
279
+ });
280
+
281
+ describe('#connect', () => {
282
+ it('should get connected - no healthcheck', (done) => {
283
+ try {
284
+ a.healthcheckType = 'none';
285
+ a.connect();
286
+
287
+ try {
288
+ assert.equal(true, a.alive);
289
+ done();
290
+ } catch (error) {
291
+ log.error(`Test Failure: ${error}`);
292
+ done(error);
293
+ }
294
+ } catch (error) {
295
+ log.error(`Adapter Exception: ${error}`);
296
+ done(error);
297
+ }
298
+ });
299
+ it('should get connected - startup healthcheck', (done) => {
300
+ try {
301
+ a.healthcheckType = 'startup';
302
+ a.connect();
303
+
304
+ try {
305
+ assert.equal(true, a.alive);
306
+ done();
307
+ } catch (error) {
308
+ log.error(`Test Failure: ${error}`);
309
+ done(error);
310
+ }
311
+ } catch (error) {
312
+ log.error(`Adapter Exception: ${error}`);
313
+ done(error);
314
+ }
315
+ });
316
+ });
317
+
318
+ describe('#healthCheck', () => {
319
+ it('should be healthy', (done) => {
320
+ try {
321
+ a.healthCheck(null, (data) => {
322
+ try {
323
+ assert.equal(true, a.healthy);
324
+ saveMockData('system', 'healthcheck', 'default', data);
325
+ done();
326
+ } catch (err) {
327
+ log.error(`Test Failure: ${err}`);
328
+ done(err);
329
+ }
330
+ });
331
+ } catch (error) {
332
+ log.error(`Adapter Exception: ${error}`);
333
+ done(error);
334
+ }
335
+ }).timeout(attemptTimeout);
336
+ });
337
+
338
+ /*
339
+ -----------------------------------------------------------------------
340
+ -----------------------------------------------------------------------
341
+ *** All code above this comment will be replaced during a migration ***
342
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
343
+ -----------------------------------------------------------------------
344
+ -----------------------------------------------------------------------
345
+ */
346
+
347
+ const acknowledgementAddanacknowledgementonmultiplehostsBodyParam = [
348
+ {}
349
+ ];
350
+ describe('#addanacknowledgementonmultiplehosts - errors', () => {
351
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
352
+ try {
353
+ a.addanacknowledgementonmultiplehosts(acknowledgementAddanacknowledgementonmultiplehostsBodyParam, (data, error) => {
354
+ try {
355
+ if (stub) {
356
+ const displayE = 'Error 400 received on request';
357
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
358
+ } else {
359
+ runCommonAsserts(data, error);
360
+ }
361
+ saveMockData('Acknowledgement', 'addanacknowledgementonmultiplehosts', 'default', data);
362
+ done();
363
+ } catch (err) {
364
+ log.error(`Test Failure: ${err}`);
365
+ done(err);
366
+ }
367
+ });
368
+ } catch (error) {
369
+ log.error(`Adapter Exception: ${error}`);
370
+ done(error);
371
+ }
372
+ }).timeout(attemptTimeout);
373
+ });
374
+
375
+ const acknowledgementHostId = 555;
376
+ const acknowledgementAddanacknowledgementonchosenhostBodyParam = {
377
+ comment: 'Acknowledged by admin',
378
+ is_notify_contacts: true,
379
+ is_persistent_comment: true,
380
+ is_sticky: true,
381
+ with_services: true
382
+ };
383
+ describe('#addanacknowledgementonchosenhost - errors', () => {
384
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
385
+ try {
386
+ a.addanacknowledgementonchosenhost(acknowledgementHostId, acknowledgementAddanacknowledgementonchosenhostBodyParam, (data, error) => {
387
+ try {
388
+ if (stub) {
389
+ const displayE = 'Error 400 received on request';
390
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
391
+ } else {
392
+ runCommonAsserts(data, error);
393
+ }
394
+ saveMockData('Acknowledgement', 'addanacknowledgementonchosenhost', 'default', data);
395
+ done();
396
+ } catch (err) {
397
+ log.error(`Test Failure: ${err}`);
398
+ done(err);
399
+ }
400
+ });
401
+ } catch (error) {
402
+ log.error(`Adapter Exception: ${error}`);
403
+ done(error);
404
+ }
405
+ }).timeout(attemptTimeout);
406
+ });
407
+
408
+ const acknowledgementServiceId = 555;
409
+ const acknowledgementAddanacknowledgementonchosenserviceBodyParam = {
410
+ comment: 'Acknowledged by admin',
411
+ is_notify_contacts: true,
412
+ is_persistent_comment: true,
413
+ is_sticky: true
414
+ };
415
+ describe('#addanacknowledgementonchosenservice - errors', () => {
416
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
417
+ try {
418
+ a.addanacknowledgementonchosenservice(acknowledgementHostId, acknowledgementServiceId, acknowledgementAddanacknowledgementonchosenserviceBodyParam, (data, error) => {
419
+ try {
420
+ if (stub) {
421
+ const displayE = 'Error 400 received on request';
422
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
423
+ } else {
424
+ runCommonAsserts(data, error);
425
+ }
426
+ saveMockData('Acknowledgement', 'addanacknowledgementonchosenservice', 'default', data);
427
+ done();
428
+ } catch (err) {
429
+ log.error(`Test Failure: ${err}`);
430
+ done(err);
431
+ }
432
+ });
433
+ } catch (error) {
434
+ log.error(`Adapter Exception: ${error}`);
435
+ done(error);
436
+ }
437
+ }).timeout(attemptTimeout);
438
+ });
439
+
440
+ const acknowledgementMetaId = 555;
441
+ const acknowledgementAddanacknowledgementonchosenmetaserviceBodyParam = {
442
+ comment: 'Acknowledged by admin',
443
+ is_notify_contacts: false,
444
+ is_persistent_comment: true,
445
+ is_sticky: true
446
+ };
447
+ describe('#addanacknowledgementonchosenmetaservice - errors', () => {
448
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
449
+ try {
450
+ a.addanacknowledgementonchosenmetaservice(acknowledgementMetaId, acknowledgementAddanacknowledgementonchosenmetaserviceBodyParam, (data, error) => {
451
+ try {
452
+ if (stub) {
453
+ const displayE = 'Error 400 received on request';
454
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
455
+ } else {
456
+ runCommonAsserts(data, error);
457
+ }
458
+ saveMockData('Acknowledgement', 'addanacknowledgementonchosenmetaservice', 'default', data);
459
+ done();
460
+ } catch (err) {
461
+ log.error(`Test Failure: ${err}`);
462
+ done(err);
463
+ }
464
+ });
465
+ } catch (error) {
466
+ log.error(`Adapter Exception: ${error}`);
467
+ done(error);
468
+ }
469
+ }).timeout(attemptTimeout);
470
+ });
471
+
472
+ const acknowledgementAcknowledgemultipleresourcesBodyParam = {
473
+ acknowledgement: {
474
+ comment: 'Acknowledged by admin',
475
+ with_services: true,
476
+ is_notify_contacts: true,
477
+ is_persistent_comment: true,
478
+ is_sticky: true,
479
+ force_active_checks: true
480
+ },
481
+ resources: [
482
+ {
483
+ type: 'service|host',
484
+ id: 12,
485
+ parent: {}
486
+ }
487
+ ]
488
+ };
489
+ describe('#acknowledgemultipleresources - errors', () => {
490
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
491
+ try {
492
+ a.acknowledgemultipleresources(acknowledgementAcknowledgemultipleresourcesBodyParam, (data, error) => {
493
+ try {
494
+ if (stub) {
495
+ const displayE = 'Error 400 received on request';
496
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
497
+ } else {
498
+ runCommonAsserts(data, error);
499
+ }
500
+ saveMockData('Acknowledgement', 'acknowledgemultipleresources', 'default', data);
501
+ done();
502
+ } catch (err) {
503
+ log.error(`Test Failure: ${err}`);
504
+ done(err);
505
+ }
506
+ });
507
+ } catch (error) {
508
+ log.error(`Adapter Exception: ${error}`);
509
+ done(error);
510
+ }
511
+ }).timeout(attemptTimeout);
512
+ });
513
+
514
+ const acknowledgementAddanacknowledgementonmultipleservicesBodyParam = [
515
+ {}
516
+ ];
517
+ describe('#addanacknowledgementonmultipleservices - errors', () => {
518
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
519
+ try {
520
+ a.addanacknowledgementonmultipleservices(acknowledgementAddanacknowledgementonmultipleservicesBodyParam, (data, error) => {
521
+ try {
522
+ if (stub) {
523
+ const displayE = 'Error 400 received on request';
524
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
525
+ } else {
526
+ runCommonAsserts(data, error);
527
+ }
528
+ saveMockData('Acknowledgement', 'addanacknowledgementonmultipleservices', 'default', data);
529
+ done();
530
+ } catch (err) {
531
+ log.error(`Test Failure: ${err}`);
532
+ done(err);
533
+ }
534
+ });
535
+ } catch (error) {
536
+ log.error(`Adapter Exception: ${error}`);
537
+ done(error);
538
+ }
539
+ }).timeout(attemptTimeout);
540
+ });
541
+
542
+ describe('#listallacknowledgements - errors', () => {
543
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
544
+ try {
545
+ a.listallacknowledgements(null, null, null, null, (data, error) => {
546
+ try {
547
+ if (stub) {
548
+ const displayE = 'Error 400 received on request';
549
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
550
+ } else {
551
+ runCommonAsserts(data, error);
552
+ }
553
+ saveMockData('Acknowledgement', 'listallacknowledgements', 'default', data);
554
+ done();
555
+ } catch (err) {
556
+ log.error(`Test Failure: ${err}`);
557
+ done(err);
558
+ }
559
+ });
560
+ } catch (error) {
561
+ log.error(`Adapter Exception: ${error}`);
562
+ done(error);
563
+ }
564
+ }).timeout(attemptTimeout);
565
+ });
566
+
567
+ const acknowledgementAcknowledgementId = 555;
568
+ describe('#displayoneacknowledgement - errors', () => {
569
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
570
+ try {
571
+ a.displayoneacknowledgement(acknowledgementAcknowledgementId, (data, error) => {
572
+ try {
573
+ if (stub) {
574
+ const displayE = 'Error 400 received on request';
575
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
576
+ } else {
577
+ runCommonAsserts(data, error);
578
+ }
579
+ saveMockData('Acknowledgement', 'displayoneacknowledgement', 'default', data);
580
+ done();
581
+ } catch (err) {
582
+ log.error(`Test Failure: ${err}`);
583
+ done(err);
584
+ }
585
+ });
586
+ } catch (error) {
587
+ log.error(`Adapter Exception: ${error}`);
588
+ done(error);
589
+ }
590
+ }).timeout(attemptTimeout);
591
+ });
592
+
593
+ describe('#listallhostsacknowledgements - errors', () => {
594
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
595
+ try {
596
+ a.listallhostsacknowledgements(null, null, null, null, (data, error) => {
597
+ try {
598
+ if (stub) {
599
+ const displayE = 'Error 400 received on request';
600
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
601
+ } else {
602
+ runCommonAsserts(data, error);
603
+ }
604
+ saveMockData('Acknowledgement', 'listallhostsacknowledgements', 'default', data);
605
+ done();
606
+ } catch (err) {
607
+ log.error(`Test Failure: ${err}`);
608
+ done(err);
609
+ }
610
+ });
611
+ } catch (error) {
612
+ log.error(`Adapter Exception: ${error}`);
613
+ done(error);
614
+ }
615
+ }).timeout(attemptTimeout);
616
+ });
617
+
618
+ describe('#listallacknowledgementsofahost - errors', () => {
619
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
620
+ try {
621
+ a.listallacknowledgementsofahost(null, null, null, null, acknowledgementHostId, (data, error) => {
622
+ try {
623
+ if (stub) {
624
+ const displayE = 'Error 400 received on request';
625
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
626
+ } else {
627
+ runCommonAsserts(data, error);
628
+ }
629
+ saveMockData('Acknowledgement', 'listallacknowledgementsofahost', 'default', data);
630
+ done();
631
+ } catch (err) {
632
+ log.error(`Test Failure: ${err}`);
633
+ done(err);
634
+ }
635
+ });
636
+ } catch (error) {
637
+ log.error(`Adapter Exception: ${error}`);
638
+ done(error);
639
+ }
640
+ }).timeout(attemptTimeout);
641
+ });
642
+
643
+ describe('#listallacknowledgementsofaservice - errors', () => {
644
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
645
+ try {
646
+ a.listallacknowledgementsofaservice(null, null, null, null, acknowledgementHostId, acknowledgementServiceId, (data, error) => {
647
+ try {
648
+ if (stub) {
649
+ const displayE = 'Error 400 received on request';
650
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
651
+ } else {
652
+ runCommonAsserts(data, error);
653
+ }
654
+ saveMockData('Acknowledgement', 'listallacknowledgementsofaservice', 'default', data);
655
+ done();
656
+ } catch (err) {
657
+ log.error(`Test Failure: ${err}`);
658
+ done(err);
659
+ }
660
+ });
661
+ } catch (error) {
662
+ log.error(`Adapter Exception: ${error}`);
663
+ done(error);
664
+ }
665
+ }).timeout(attemptTimeout);
666
+ });
667
+
668
+ describe('#listallacknowledgementsofametaservice - errors', () => {
669
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
670
+ try {
671
+ a.listallacknowledgementsofametaservice(null, null, null, null, acknowledgementMetaId, (data, error) => {
672
+ try {
673
+ if (stub) {
674
+ const displayE = 'Error 400 received on request';
675
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
676
+ } else {
677
+ runCommonAsserts(data, error);
678
+ }
679
+ saveMockData('Acknowledgement', 'listallacknowledgementsofametaservice', 'default', data);
680
+ done();
681
+ } catch (err) {
682
+ log.error(`Test Failure: ${err}`);
683
+ done(err);
684
+ }
685
+ });
686
+ } catch (error) {
687
+ log.error(`Adapter Exception: ${error}`);
688
+ done(error);
689
+ }
690
+ }).timeout(attemptTimeout);
691
+ });
692
+
693
+ describe('#listallservicesacknowledgements - errors', () => {
694
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
695
+ try {
696
+ a.listallservicesacknowledgements(null, null, null, null, (data, error) => {
697
+ try {
698
+ if (stub) {
699
+ const displayE = 'Error 400 received on request';
700
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
701
+ } else {
702
+ runCommonAsserts(data, error);
703
+ }
704
+ saveMockData('Acknowledgement', 'listallservicesacknowledgements', 'default', data);
705
+ done();
706
+ } catch (err) {
707
+ log.error(`Test Failure: ${err}`);
708
+ done(err);
709
+ }
710
+ });
711
+ } catch (error) {
712
+ log.error(`Adapter Exception: ${error}`);
713
+ done(error);
714
+ }
715
+ }).timeout(attemptTimeout);
716
+ });
717
+
718
+ const downtimeAddandowntimeonmultiplehostsBodyParam = [
719
+ {}
720
+ ];
721
+ describe('#addandowntimeonmultiplehosts - errors', () => {
722
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
723
+ try {
724
+ a.addandowntimeonmultiplehosts(downtimeAddandowntimeonmultiplehostsBodyParam, (data, error) => {
725
+ try {
726
+ if (stub) {
727
+ const displayE = 'Error 400 received on request';
728
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
729
+ } else {
730
+ runCommonAsserts(data, error);
731
+ }
732
+ saveMockData('Downtime', 'addandowntimeonmultiplehosts', 'default', data);
733
+ done();
734
+ } catch (err) {
735
+ log.error(`Test Failure: ${err}`);
736
+ done(err);
737
+ }
738
+ });
739
+ } catch (error) {
740
+ log.error(`Adapter Exception: ${error}`);
741
+ done(error);
742
+ }
743
+ }).timeout(attemptTimeout);
744
+ });
745
+
746
+ const downtimeHostId = 555;
747
+ const downtimeAddadowntimeonahostBodyParam = {
748
+ start_time: 'string',
749
+ end_time: 'string',
750
+ is_fixed: true,
751
+ duration: 3600,
752
+ author_id: 3,
753
+ comment: 'Downtime set by admin',
754
+ with_services: true
755
+ };
756
+ describe('#addadowntimeonahost - errors', () => {
757
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
758
+ try {
759
+ a.addadowntimeonahost(downtimeHostId, downtimeAddadowntimeonahostBodyParam, (data, error) => {
760
+ try {
761
+ if (stub) {
762
+ const displayE = 'Error 400 received on request';
763
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
764
+ } else {
765
+ runCommonAsserts(data, error);
766
+ }
767
+ saveMockData('Downtime', 'addadowntimeonahost', 'default', data);
768
+ done();
769
+ } catch (err) {
770
+ log.error(`Test Failure: ${err}`);
771
+ done(err);
772
+ }
773
+ });
774
+ } catch (error) {
775
+ log.error(`Adapter Exception: ${error}`);
776
+ done(error);
777
+ }
778
+ }).timeout(attemptTimeout);
779
+ });
780
+
781
+ const downtimeServiceId = 555;
782
+ const downtimeAddadowntimeonaserviceBodyParam = {
783
+ start_time: 'string',
784
+ end_time: 'string',
785
+ is_fixed: true,
786
+ duration: 3600,
787
+ author_id: 3,
788
+ comment: 'Downtime set by admin'
789
+ };
790
+ describe('#addadowntimeonaservice - errors', () => {
791
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
792
+ try {
793
+ a.addadowntimeonaservice(downtimeHostId, downtimeServiceId, downtimeAddadowntimeonaserviceBodyParam, (data, error) => {
794
+ try {
795
+ if (stub) {
796
+ const displayE = 'Error 400 received on request';
797
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
798
+ } else {
799
+ runCommonAsserts(data, error);
800
+ }
801
+ saveMockData('Downtime', 'addadowntimeonaservice', 'default', data);
802
+ done();
803
+ } catch (err) {
804
+ log.error(`Test Failure: ${err}`);
805
+ done(err);
806
+ }
807
+ });
808
+ } catch (error) {
809
+ log.error(`Adapter Exception: ${error}`);
810
+ done(error);
811
+ }
812
+ }).timeout(attemptTimeout);
813
+ });
814
+
815
+ const downtimeMetaId = 555;
816
+ const downtimeAddadowntimeonametaserviceBodyParam = {
817
+ start_time: 'string',
818
+ end_time: 'string',
819
+ is_fixed: true,
820
+ duration: 3600,
821
+ author_id: 3,
822
+ comment: 'Downtime set by admin'
823
+ };
824
+ describe('#addadowntimeonametaservice - errors', () => {
825
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
826
+ try {
827
+ a.addadowntimeonametaservice(downtimeMetaId, downtimeAddadowntimeonametaserviceBodyParam, (data, error) => {
828
+ try {
829
+ if (stub) {
830
+ const displayE = 'Error 400 received on request';
831
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
832
+ } else {
833
+ runCommonAsserts(data, error);
834
+ }
835
+ saveMockData('Downtime', 'addadowntimeonametaservice', 'default', data);
836
+ done();
837
+ } catch (err) {
838
+ log.error(`Test Failure: ${err}`);
839
+ done(err);
840
+ }
841
+ });
842
+ } catch (error) {
843
+ log.error(`Adapter Exception: ${error}`);
844
+ done(error);
845
+ }
846
+ }).timeout(attemptTimeout);
847
+ });
848
+
849
+ const downtimeSetdowntimeformultipleresourcesBodyParam = {
850
+ downtime: {
851
+ comment: 'Downtime set by admin',
852
+ with_services: true,
853
+ is_fixed: true,
854
+ duration: 7200,
855
+ start_time: 'string',
856
+ end_time: 'string'
857
+ },
858
+ resources: [
859
+ {
860
+ type: 'service|host',
861
+ id: 12,
862
+ parent: {}
863
+ }
864
+ ]
865
+ };
866
+ describe('#setdowntimeformultipleresources - errors', () => {
867
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
868
+ try {
869
+ a.setdowntimeformultipleresources(downtimeSetdowntimeformultipleresourcesBodyParam, (data, error) => {
870
+ try {
871
+ if (stub) {
872
+ const displayE = 'Error 400 received on request';
873
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
874
+ } else {
875
+ runCommonAsserts(data, error);
876
+ }
877
+ saveMockData('Downtime', 'setdowntimeformultipleresources', 'default', data);
878
+ done();
879
+ } catch (err) {
880
+ log.error(`Test Failure: ${err}`);
881
+ done(err);
882
+ }
883
+ });
884
+ } catch (error) {
885
+ log.error(`Adapter Exception: ${error}`);
886
+ done(error);
887
+ }
888
+ }).timeout(attemptTimeout);
889
+ });
890
+
891
+ const downtimeAddandowntimeonmultipleservicesBodyParam = [
892
+ {}
893
+ ];
894
+ describe('#addandowntimeonmultipleservices - errors', () => {
895
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
896
+ try {
897
+ a.addandowntimeonmultipleservices(downtimeAddandowntimeonmultipleservicesBodyParam, (data, error) => {
898
+ try {
899
+ if (stub) {
900
+ const displayE = 'Error 400 received on request';
901
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
902
+ } else {
903
+ runCommonAsserts(data, error);
904
+ }
905
+ saveMockData('Downtime', 'addandowntimeonmultipleservices', 'default', data);
906
+ done();
907
+ } catch (err) {
908
+ log.error(`Test Failure: ${err}`);
909
+ done(err);
910
+ }
911
+ });
912
+ } catch (error) {
913
+ log.error(`Adapter Exception: ${error}`);
914
+ done(error);
915
+ }
916
+ }).timeout(attemptTimeout);
917
+ });
918
+
919
+ describe('#listalldowntimes - errors', () => {
920
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
921
+ try {
922
+ a.listalldowntimes(null, null, null, null, (data, error) => {
923
+ try {
924
+ if (stub) {
925
+ const displayE = 'Error 400 received on request';
926
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
927
+ } else {
928
+ runCommonAsserts(data, error);
929
+ }
930
+ saveMockData('Downtime', 'listalldowntimes', 'default', data);
931
+ done();
932
+ } catch (err) {
933
+ log.error(`Test Failure: ${err}`);
934
+ done(err);
935
+ }
936
+ });
937
+ } catch (error) {
938
+ log.error(`Adapter Exception: ${error}`);
939
+ done(error);
940
+ }
941
+ }).timeout(attemptTimeout);
942
+ });
943
+
944
+ const downtimeDowntimeId = 555;
945
+ describe('#displayonedowntime - errors', () => {
946
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
947
+ try {
948
+ a.displayonedowntime(downtimeDowntimeId, (data, error) => {
949
+ try {
950
+ if (stub) {
951
+ const displayE = 'Error 400 received on request';
952
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
953
+ } else {
954
+ runCommonAsserts(data, error);
955
+ }
956
+ saveMockData('Downtime', 'displayonedowntime', 'default', data);
957
+ done();
958
+ } catch (err) {
959
+ log.error(`Test Failure: ${err}`);
960
+ done(err);
961
+ }
962
+ });
963
+ } catch (error) {
964
+ log.error(`Adapter Exception: ${error}`);
965
+ done(error);
966
+ }
967
+ }).timeout(attemptTimeout);
968
+ });
969
+
970
+ describe('#listallhostsdowntimes - errors', () => {
971
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
972
+ try {
973
+ a.listallhostsdowntimes(null, null, null, null, (data, error) => {
974
+ try {
975
+ if (stub) {
976
+ const displayE = 'Error 400 received on request';
977
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
978
+ } else {
979
+ runCommonAsserts(data, error);
980
+ }
981
+ saveMockData('Downtime', 'listallhostsdowntimes', 'default', data);
982
+ done();
983
+ } catch (err) {
984
+ log.error(`Test Failure: ${err}`);
985
+ done(err);
986
+ }
987
+ });
988
+ } catch (error) {
989
+ log.error(`Adapter Exception: ${error}`);
990
+ done(error);
991
+ }
992
+ }).timeout(attemptTimeout);
993
+ });
994
+
995
+ describe('#listalldowntimesofahost - errors', () => {
996
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
997
+ try {
998
+ a.listalldowntimesofahost(downtimeHostId, null, null, null, null, null, (data, error) => {
999
+ try {
1000
+ if (stub) {
1001
+ const displayE = 'Error 400 received on request';
1002
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1003
+ } else {
1004
+ runCommonAsserts(data, error);
1005
+ }
1006
+ saveMockData('Downtime', 'listalldowntimesofahost', 'default', data);
1007
+ done();
1008
+ } catch (err) {
1009
+ log.error(`Test Failure: ${err}`);
1010
+ done(err);
1011
+ }
1012
+ });
1013
+ } catch (error) {
1014
+ log.error(`Adapter Exception: ${error}`);
1015
+ done(error);
1016
+ }
1017
+ }).timeout(attemptTimeout);
1018
+ });
1019
+
1020
+ describe('#listalldowntimesofaservice - errors', () => {
1021
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1022
+ try {
1023
+ a.listalldowntimesofaservice(null, null, null, null, downtimeHostId, downtimeServiceId, (data, error) => {
1024
+ try {
1025
+ if (stub) {
1026
+ const displayE = 'Error 400 received on request';
1027
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1028
+ } else {
1029
+ runCommonAsserts(data, error);
1030
+ }
1031
+ saveMockData('Downtime', 'listalldowntimesofaservice', 'default', data);
1032
+ done();
1033
+ } catch (err) {
1034
+ log.error(`Test Failure: ${err}`);
1035
+ done(err);
1036
+ }
1037
+ });
1038
+ } catch (error) {
1039
+ log.error(`Adapter Exception: ${error}`);
1040
+ done(error);
1041
+ }
1042
+ }).timeout(attemptTimeout);
1043
+ });
1044
+
1045
+ describe('#listalldowntimesofametaservice - errors', () => {
1046
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1047
+ try {
1048
+ a.listalldowntimesofametaservice(null, null, null, null, downtimeMetaId, (data, error) => {
1049
+ try {
1050
+ if (stub) {
1051
+ const displayE = 'Error 400 received on request';
1052
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1053
+ } else {
1054
+ runCommonAsserts(data, error);
1055
+ }
1056
+ saveMockData('Downtime', 'listalldowntimesofametaservice', 'default', data);
1057
+ done();
1058
+ } catch (err) {
1059
+ log.error(`Test Failure: ${err}`);
1060
+ done(err);
1061
+ }
1062
+ });
1063
+ } catch (error) {
1064
+ log.error(`Adapter Exception: ${error}`);
1065
+ done(error);
1066
+ }
1067
+ }).timeout(attemptTimeout);
1068
+ });
1069
+
1070
+ describe('#listallservicesdowntimes - errors', () => {
1071
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1072
+ try {
1073
+ a.listallservicesdowntimes(null, null, null, null, (data, error) => {
1074
+ try {
1075
+ if (stub) {
1076
+ const displayE = 'Error 400 received on request';
1077
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1078
+ } else {
1079
+ runCommonAsserts(data, error);
1080
+ }
1081
+ saveMockData('Downtime', 'listallservicesdowntimes', 'default', data);
1082
+ done();
1083
+ } catch (err) {
1084
+ log.error(`Test Failure: ${err}`);
1085
+ done(err);
1086
+ }
1087
+ });
1088
+ } catch (error) {
1089
+ log.error(`Adapter Exception: ${error}`);
1090
+ done(error);
1091
+ }
1092
+ }).timeout(attemptTimeout);
1093
+ });
1094
+
1095
+ describe('#listallmetaservicesconfigurations - errors', () => {
1096
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1097
+ try {
1098
+ a.listallmetaservicesconfigurations(null, null, null, null, (data, error) => {
1099
+ try {
1100
+ if (stub) {
1101
+ const displayE = 'Error 400 received on request';
1102
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1103
+ } else {
1104
+ runCommonAsserts(data, error);
1105
+ }
1106
+ saveMockData('MetaService', 'listallmetaservicesconfigurations', 'default', data);
1107
+ done();
1108
+ } catch (err) {
1109
+ log.error(`Test Failure: ${err}`);
1110
+ done(err);
1111
+ }
1112
+ });
1113
+ } catch (error) {
1114
+ log.error(`Adapter Exception: ${error}`);
1115
+ done(error);
1116
+ }
1117
+ }).timeout(attemptTimeout);
1118
+ });
1119
+
1120
+ const metaServiceMetaId = 555;
1121
+ describe('#getametaservice - errors', () => {
1122
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1123
+ try {
1124
+ a.getametaservice(metaServiceMetaId, (data, error) => {
1125
+ try {
1126
+ if (stub) {
1127
+ const displayE = 'Error 400 received on request';
1128
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1129
+ } else {
1130
+ runCommonAsserts(data, error);
1131
+ }
1132
+ saveMockData('MetaService', 'getametaservice', 'default', data);
1133
+ done();
1134
+ } catch (err) {
1135
+ log.error(`Test Failure: ${err}`);
1136
+ done(err);
1137
+ }
1138
+ });
1139
+ } catch (error) {
1140
+ log.error(`Adapter Exception: ${error}`);
1141
+ done(error);
1142
+ }
1143
+ }).timeout(attemptTimeout);
1144
+ });
1145
+
1146
+ describe('#listallmetaservicemetrics - errors', () => {
1147
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1148
+ try {
1149
+ a.listallmetaservicemetrics(null, null, null, null, metaServiceMetaId, (data, error) => {
1150
+ try {
1151
+ if (stub) {
1152
+ const displayE = 'Error 400 received on request';
1153
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1154
+ } else {
1155
+ runCommonAsserts(data, error);
1156
+ }
1157
+ saveMockData('MetaService', 'listallmetaservicemetrics', 'default', data);
1158
+ done();
1159
+ } catch (err) {
1160
+ log.error(`Test Failure: ${err}`);
1161
+ done(err);
1162
+ }
1163
+ });
1164
+ } catch (error) {
1165
+ log.error(`Adapter Exception: ${error}`);
1166
+ done(error);
1167
+ }
1168
+ }).timeout(attemptTimeout);
1169
+ });
1170
+
1171
+ const checkCheckmultiplehostsBodyParam = [
1172
+ {}
1173
+ ];
1174
+ describe('#checkmultiplehosts - errors', () => {
1175
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1176
+ try {
1177
+ a.checkmultiplehosts(checkCheckmultiplehostsBodyParam, (data, error) => {
1178
+ try {
1179
+ if (stub) {
1180
+ const displayE = 'Error 400 received on request';
1181
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1182
+ } else {
1183
+ runCommonAsserts(data, error);
1184
+ }
1185
+ saveMockData('Check', 'checkmultiplehosts', 'default', data);
1186
+ done();
1187
+ } catch (err) {
1188
+ log.error(`Test Failure: ${err}`);
1189
+ done(err);
1190
+ }
1191
+ });
1192
+ } catch (error) {
1193
+ log.error(`Adapter Exception: ${error}`);
1194
+ done(error);
1195
+ }
1196
+ }).timeout(attemptTimeout);
1197
+ });
1198
+
1199
+ const checkHostId = 555;
1200
+ const checkCheckhostBodyParam = {
1201
+ is_forced: true
1202
+ };
1203
+ describe('#checkhost - errors', () => {
1204
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1205
+ try {
1206
+ a.checkhost(checkHostId, checkCheckhostBodyParam, (data, error) => {
1207
+ try {
1208
+ if (stub) {
1209
+ const displayE = 'Error 400 received on request';
1210
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1211
+ } else {
1212
+ runCommonAsserts(data, error);
1213
+ }
1214
+ saveMockData('Check', 'checkhost', 'default', data);
1215
+ done();
1216
+ } catch (err) {
1217
+ log.error(`Test Failure: ${err}`);
1218
+ done(err);
1219
+ }
1220
+ });
1221
+ } catch (error) {
1222
+ log.error(`Adapter Exception: ${error}`);
1223
+ done(error);
1224
+ }
1225
+ }).timeout(attemptTimeout);
1226
+ });
1227
+
1228
+ const checkServiceId = 555;
1229
+ const checkCheckserviceBodyParam = {
1230
+ is_forced: true
1231
+ };
1232
+ describe('#checkservice - errors', () => {
1233
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1234
+ try {
1235
+ a.checkservice(checkHostId, checkServiceId, checkCheckserviceBodyParam, (data, error) => {
1236
+ try {
1237
+ if (stub) {
1238
+ const displayE = 'Error 400 received on request';
1239
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1240
+ } else {
1241
+ runCommonAsserts(data, error);
1242
+ }
1243
+ saveMockData('Check', 'checkservice', 'default', data);
1244
+ done();
1245
+ } catch (err) {
1246
+ log.error(`Test Failure: ${err}`);
1247
+ done(err);
1248
+ }
1249
+ });
1250
+ } catch (error) {
1251
+ log.error(`Adapter Exception: ${error}`);
1252
+ done(error);
1253
+ }
1254
+ }).timeout(attemptTimeout);
1255
+ });
1256
+
1257
+ const checkMetaId = 555;
1258
+ const checkCheckmetaserviceBodyParam = {
1259
+ is_forced: true
1260
+ };
1261
+ describe('#checkmetaservice - errors', () => {
1262
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1263
+ try {
1264
+ a.checkmetaservice(checkMetaId, checkCheckmetaserviceBodyParam, (data, error) => {
1265
+ try {
1266
+ if (stub) {
1267
+ const displayE = 'Error 400 received on request';
1268
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1269
+ } else {
1270
+ runCommonAsserts(data, error);
1271
+ }
1272
+ saveMockData('Check', 'checkmetaservice', 'default', data);
1273
+ done();
1274
+ } catch (err) {
1275
+ log.error(`Test Failure: ${err}`);
1276
+ done(err);
1277
+ }
1278
+ });
1279
+ } catch (error) {
1280
+ log.error(`Adapter Exception: ${error}`);
1281
+ done(error);
1282
+ }
1283
+ }).timeout(attemptTimeout);
1284
+ });
1285
+
1286
+ const checkCheckresourcesBodyParam = {
1287
+ check: {
1288
+ is_forced: true
1289
+ },
1290
+ resources: [
1291
+ {
1292
+ type: null,
1293
+ id: 10,
1294
+ parent: {}
1295
+ }
1296
+ ]
1297
+ };
1298
+ describe('#checkresources - errors', () => {
1299
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1300
+ try {
1301
+ a.checkresources(checkCheckresourcesBodyParam, (data, error) => {
1302
+ try {
1303
+ if (stub) {
1304
+ const displayE = 'Error 400 received on request';
1305
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1306
+ } else {
1307
+ runCommonAsserts(data, error);
1308
+ }
1309
+ saveMockData('Check', 'checkresources', 'default', data);
1310
+ done();
1311
+ } catch (err) {
1312
+ log.error(`Test Failure: ${err}`);
1313
+ done(err);
1314
+ }
1315
+ });
1316
+ } catch (error) {
1317
+ log.error(`Adapter Exception: ${error}`);
1318
+ done(error);
1319
+ }
1320
+ }).timeout(attemptTimeout);
1321
+ });
1322
+
1323
+ const checkCheckmultipleservicesBodyParam = [
1324
+ {}
1325
+ ];
1326
+ describe('#checkmultipleservices - errors', () => {
1327
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1328
+ try {
1329
+ a.checkmultipleservices(checkCheckmultipleservicesBodyParam, (data, error) => {
1330
+ try {
1331
+ if (stub) {
1332
+ const displayE = 'Error 400 received on request';
1333
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1334
+ } else {
1335
+ runCommonAsserts(data, error);
1336
+ }
1337
+ saveMockData('Check', 'checkmultipleservices', 'default', data);
1338
+ done();
1339
+ } catch (err) {
1340
+ log.error(`Test Failure: ${err}`);
1341
+ done(err);
1342
+ }
1343
+ });
1344
+ } catch (error) {
1345
+ log.error(`Adapter Exception: ${error}`);
1346
+ done(error);
1347
+ }
1348
+ }).timeout(attemptTimeout);
1349
+ });
1350
+
1351
+ const submitHostId = 555;
1352
+ const submitServiceId = 555;
1353
+ const submitSubmitaresulttoasingleserviceBodyParam = {
1354
+ status: null
1355
+ };
1356
+ describe('#submitaresulttoasingleservice - errors', () => {
1357
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1358
+ try {
1359
+ a.submitaresulttoasingleservice(submitHostId, submitServiceId, submitSubmitaresulttoasingleserviceBodyParam, (data, error) => {
1360
+ try {
1361
+ if (stub) {
1362
+ const displayE = 'Error 400 received on request';
1363
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1364
+ } else {
1365
+ runCommonAsserts(data, error);
1366
+ }
1367
+ saveMockData('Submit', 'submitaresulttoasingleservice', 'default', data);
1368
+ done();
1369
+ } catch (err) {
1370
+ log.error(`Test Failure: ${err}`);
1371
+ done(err);
1372
+ }
1373
+ });
1374
+ } catch (error) {
1375
+ log.error(`Adapter Exception: ${error}`);
1376
+ done(error);
1377
+ }
1378
+ }).timeout(attemptTimeout);
1379
+ });
1380
+
1381
+ const submitSubmitaresulttoasinglehostBodyParam = {
1382
+ status: null
1383
+ };
1384
+ describe('#submitaresulttoasinglehost - errors', () => {
1385
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1386
+ try {
1387
+ a.submitaresulttoasinglehost(submitHostId, submitSubmitaresulttoasinglehostBodyParam, (data, error) => {
1388
+ try {
1389
+ if (stub) {
1390
+ const displayE = 'Error 400 received on request';
1391
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1392
+ } else {
1393
+ runCommonAsserts(data, error);
1394
+ }
1395
+ saveMockData('Submit', 'submitaresulttoasinglehost', 'default', data);
1396
+ done();
1397
+ } catch (err) {
1398
+ log.error(`Test Failure: ${err}`);
1399
+ done(err);
1400
+ }
1401
+ });
1402
+ } catch (error) {
1403
+ log.error(`Adapter Exception: ${error}`);
1404
+ done(error);
1405
+ }
1406
+ }).timeout(attemptTimeout);
1407
+ });
1408
+
1409
+ const submitMetaId = 555;
1410
+ const submitSubmitaresulttoasinglemetaserviceBodyParam = {
1411
+ status: null
1412
+ };
1413
+ describe('#submitaresulttoasinglemetaservice - errors', () => {
1414
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1415
+ try {
1416
+ a.submitaresulttoasinglemetaservice(submitMetaId, submitSubmitaresulttoasinglemetaserviceBodyParam, (data, error) => {
1417
+ try {
1418
+ if (stub) {
1419
+ const displayE = 'Error 400 received on request';
1420
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1421
+ } else {
1422
+ runCommonAsserts(data, error);
1423
+ }
1424
+ saveMockData('Submit', 'submitaresulttoasinglemetaservice', 'default', data);
1425
+ done();
1426
+ } catch (err) {
1427
+ log.error(`Test Failure: ${err}`);
1428
+ done(err);
1429
+ }
1430
+ });
1431
+ } catch (error) {
1432
+ log.error(`Adapter Exception: ${error}`);
1433
+ done(error);
1434
+ }
1435
+ }).timeout(attemptTimeout);
1436
+ });
1437
+
1438
+ const submitSubmitresulttoresourcesBodyParam = {
1439
+ resources: [
1440
+ {}
1441
+ ]
1442
+ };
1443
+ describe('#submitresulttoresources - errors', () => {
1444
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1445
+ try {
1446
+ a.submitresulttoresources(submitSubmitresulttoresourcesBodyParam, (data, error) => {
1447
+ try {
1448
+ if (stub) {
1449
+ const displayE = 'Error 400 received on request';
1450
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1451
+ } else {
1452
+ runCommonAsserts(data, error);
1453
+ }
1454
+ saveMockData('Submit', 'submitresulttoresources', 'default', data);
1455
+ done();
1456
+ } catch (err) {
1457
+ log.error(`Test Failure: ${err}`);
1458
+ done(err);
1459
+ }
1460
+ });
1461
+ } catch (error) {
1462
+ log.error(`Adapter Exception: ${error}`);
1463
+ done(error);
1464
+ }
1465
+ }).timeout(attemptTimeout);
1466
+ });
1467
+
1468
+ describe('#administrationparameters - errors', () => {
1469
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1470
+ try {
1471
+ a.administrationparameters((data, error) => {
1472
+ try {
1473
+ if (stub) {
1474
+ const displayE = 'Error 400 received on request';
1475
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1476
+ } else {
1477
+ runCommonAsserts(data, error);
1478
+ }
1479
+ saveMockData('Administration', 'administrationparameters', 'default', data);
1480
+ done();
1481
+ } catch (err) {
1482
+ log.error(`Test Failure: ${err}`);
1483
+ done(err);
1484
+ }
1485
+ });
1486
+ } catch (error) {
1487
+ log.error(`Adapter Exception: ${error}`);
1488
+ done(error);
1489
+ }
1490
+ }).timeout(attemptTimeout);
1491
+ });
1492
+
1493
+ const administrationVaultId = 555;
1494
+ const administrationCreatevaultconfigurationBodyParam = {
1495
+ name: 'centreon_vault',
1496
+ address: '127.0.0.1',
1497
+ port: 8200,
1498
+ root_path: 'centreon',
1499
+ role_id: 'string',
1500
+ secret_id: 'string'
1501
+ };
1502
+ describe('#createvaultconfiguration - errors', () => {
1503
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1504
+ try {
1505
+ a.createvaultconfiguration(administrationVaultId, administrationCreatevaultconfigurationBodyParam, (data, error) => {
1506
+ try {
1507
+ if (stub) {
1508
+ const displayE = 'Error 400 received on request';
1509
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1510
+ } else {
1511
+ runCommonAsserts(data, error);
1512
+ }
1513
+ saveMockData('Administration', 'createvaultconfiguration', 'default', data);
1514
+ done();
1515
+ } catch (err) {
1516
+ log.error(`Test Failure: ${err}`);
1517
+ done(err);
1518
+ }
1519
+ });
1520
+ } catch (error) {
1521
+ log.error(`Adapter Exception: ${error}`);
1522
+ done(error);
1523
+ }
1524
+ }).timeout(attemptTimeout);
1525
+ });
1526
+
1527
+ const administrationUpdatelocalproviderconfigurationBodyParam = {
1528
+ password_security_policy: {}
1529
+ };
1530
+ describe('#updatelocalproviderconfiguration - errors', () => {
1531
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1532
+ try {
1533
+ a.updatelocalproviderconfiguration(administrationUpdatelocalproviderconfigurationBodyParam, (data, error) => {
1534
+ try {
1535
+ if (stub) {
1536
+ const displayE = 'Error 400 received on request';
1537
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1538
+ } else {
1539
+ runCommonAsserts(data, error);
1540
+ }
1541
+ saveMockData('Administration', 'updatelocalproviderconfiguration', 'default', data);
1542
+ done();
1543
+ } catch (err) {
1544
+ log.error(`Test Failure: ${err}`);
1545
+ done(err);
1546
+ }
1547
+ });
1548
+ } catch (error) {
1549
+ log.error(`Adapter Exception: ${error}`);
1550
+ done(error);
1551
+ }
1552
+ }).timeout(attemptTimeout);
1553
+ });
1554
+
1555
+ describe('#getlocalproviderconfigurationwithpasswordsecuritypolicy - errors', () => {
1556
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1557
+ try {
1558
+ a.getlocalproviderconfigurationwithpasswordsecuritypolicy((data, error) => {
1559
+ try {
1560
+ if (stub) {
1561
+ const displayE = 'Error 400 received on request';
1562
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1563
+ } else {
1564
+ runCommonAsserts(data, error);
1565
+ }
1566
+ saveMockData('Administration', 'getlocalproviderconfigurationwithpasswordsecuritypolicy', 'default', data);
1567
+ done();
1568
+ } catch (err) {
1569
+ log.error(`Test Failure: ${err}`);
1570
+ done(err);
1571
+ }
1572
+ });
1573
+ } catch (error) {
1574
+ log.error(`Adapter Exception: ${error}`);
1575
+ done(error);
1576
+ }
1577
+ }).timeout(attemptTimeout);
1578
+ });
1579
+
1580
+ const administrationUpdateopenidproviderconfigurationBodyParam = {
1581
+ is_active: true,
1582
+ is_forced: true,
1583
+ base_url: 'https://localhost:8080',
1584
+ authorization_endpoint: '/authorize',
1585
+ token_endpoint: '/token',
1586
+ introspection_token_endpoint: '/introspect',
1587
+ userinfo_endpoint: '/userinfo',
1588
+ endsession_endpoint: '/logout',
1589
+ connection_scopes: [
1590
+ 'string'
1591
+ ],
1592
+ login_claim: 'sub',
1593
+ client_id: 'client_id',
1594
+ client_secret: 'client_secret',
1595
+ authentication_type: null,
1596
+ verify_peer: true,
1597
+ auto_import: true,
1598
+ contact_template: {},
1599
+ email_bind_attribute: 'email',
1600
+ fullname_bind_attribute: 'name',
1601
+ redirect_url: 'https://my_custom_domain.com'
1602
+ };
1603
+ describe('#updateopenidproviderconfiguration - errors', () => {
1604
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1605
+ try {
1606
+ a.updateopenidproviderconfiguration(administrationUpdateopenidproviderconfigurationBodyParam, (data, error) => {
1607
+ try {
1608
+ if (stub) {
1609
+ const displayE = 'Error 400 received on request';
1610
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1611
+ } else {
1612
+ runCommonAsserts(data, error);
1613
+ }
1614
+ saveMockData('Administration', 'updateopenidproviderconfiguration', 'default', data);
1615
+ done();
1616
+ } catch (err) {
1617
+ log.error(`Test Failure: ${err}`);
1618
+ done(err);
1619
+ }
1620
+ });
1621
+ } catch (error) {
1622
+ log.error(`Adapter Exception: ${error}`);
1623
+ done(error);
1624
+ }
1625
+ }).timeout(attemptTimeout);
1626
+ });
1627
+
1628
+ describe('#getopenidproviderconfiguration - errors', () => {
1629
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1630
+ try {
1631
+ a.getopenidproviderconfiguration((data, error) => {
1632
+ try {
1633
+ if (stub) {
1634
+ const displayE = 'Error 400 received on request';
1635
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1636
+ } else {
1637
+ runCommonAsserts(data, error);
1638
+ }
1639
+ saveMockData('Administration', 'getopenidproviderconfiguration', 'default', data);
1640
+ done();
1641
+ } catch (err) {
1642
+ log.error(`Test Failure: ${err}`);
1643
+ done(err);
1644
+ }
1645
+ });
1646
+ } catch (error) {
1647
+ log.error(`Adapter Exception: ${error}`);
1648
+ done(error);
1649
+ }
1650
+ }).timeout(attemptTimeout);
1651
+ });
1652
+
1653
+ const administrationUpdateSAMLproviderconfigurationBodyParam = {
1654
+ is_active: true,
1655
+ is_forced: true,
1656
+ remote_login_url: 'https://idp/saml',
1657
+ entity_id_url: 'https://idp/saml',
1658
+ certificate: 'string',
1659
+ user_id_attribute: 'string',
1660
+ logout_from: false,
1661
+ contact_template: {},
1662
+ email_bind_attribute: 'email',
1663
+ fullname_bind_attribute: 'name'
1664
+ };
1665
+ describe('#updateSAMLproviderconfiguration - errors', () => {
1666
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1667
+ try {
1668
+ a.updateSAMLproviderconfiguration(administrationUpdateSAMLproviderconfigurationBodyParam, (data, error) => {
1669
+ try {
1670
+ if (stub) {
1671
+ const displayE = 'Error 400 received on request';
1672
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1673
+ } else {
1674
+ runCommonAsserts(data, error);
1675
+ }
1676
+ saveMockData('Administration', 'updateSAMLproviderconfiguration', 'default', data);
1677
+ done();
1678
+ } catch (err) {
1679
+ log.error(`Test Failure: ${err}`);
1680
+ done(err);
1681
+ }
1682
+ });
1683
+ } catch (error) {
1684
+ log.error(`Adapter Exception: ${error}`);
1685
+ done(error);
1686
+ }
1687
+ }).timeout(attemptTimeout);
1688
+ });
1689
+
1690
+ describe('#getSAMLproviderconfiguration - errors', () => {
1691
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1692
+ try {
1693
+ a.getSAMLproviderconfiguration((data, error) => {
1694
+ try {
1695
+ if (stub) {
1696
+ const displayE = 'Error 400 received on request';
1697
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1698
+ } else {
1699
+ runCommonAsserts(data, error);
1700
+ }
1701
+ saveMockData('Administration', 'getSAMLproviderconfiguration', 'default', data);
1702
+ done();
1703
+ } catch (err) {
1704
+ log.error(`Test Failure: ${err}`);
1705
+ done(err);
1706
+ }
1707
+ });
1708
+ } catch (error) {
1709
+ log.error(`Adapter Exception: ${error}`);
1710
+ done(error);
1711
+ }
1712
+ }).timeout(attemptTimeout);
1713
+ });
1714
+
1715
+ const administrationUpdatewebSsoproviderconfigurationBodyParam = {
1716
+ is_active: true,
1717
+ is_forced: false,
1718
+ trusted_client_addresses: [
1719
+ 'string'
1720
+ ],
1721
+ blacklist_client_addresses: [
1722
+ 'string'
1723
+ ],
1724
+ login_header_attribute: 'HTTP_AUTH_USER',
1725
+ pattern_matching_login: '/@.*/',
1726
+ pattern_replace_login: '/@.*/'
1727
+ };
1728
+ describe('#updatewebSsoproviderconfiguration - errors', () => {
1729
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1730
+ try {
1731
+ a.updatewebSsoproviderconfiguration(administrationUpdatewebSsoproviderconfigurationBodyParam, (data, error) => {
1732
+ try {
1733
+ if (stub) {
1734
+ const displayE = 'Error 400 received on request';
1735
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1736
+ } else {
1737
+ runCommonAsserts(data, error);
1738
+ }
1739
+ saveMockData('Administration', 'updatewebSsoproviderconfiguration', 'default', data);
1740
+ done();
1741
+ } catch (err) {
1742
+ log.error(`Test Failure: ${err}`);
1743
+ done(err);
1744
+ }
1745
+ });
1746
+ } catch (error) {
1747
+ log.error(`Adapter Exception: ${error}`);
1748
+ done(error);
1749
+ }
1750
+ }).timeout(attemptTimeout);
1751
+ });
1752
+
1753
+ describe('#getwebSsoproviderconfigurationinformation - errors', () => {
1754
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1755
+ try {
1756
+ a.getwebSsoproviderconfigurationinformation((data, error) => {
1757
+ try {
1758
+ if (stub) {
1759
+ const displayE = 'Error 400 received on request';
1760
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1761
+ } else {
1762
+ runCommonAsserts(data, error);
1763
+ }
1764
+ saveMockData('Administration', 'getwebSsoproviderconfigurationinformation', 'default', data);
1765
+ done();
1766
+ } catch (err) {
1767
+ log.error(`Test Failure: ${err}`);
1768
+ done(err);
1769
+ }
1770
+ });
1771
+ } catch (error) {
1772
+ log.error(`Adapter Exception: ${error}`);
1773
+ done(error);
1774
+ }
1775
+ }).timeout(attemptTimeout);
1776
+ });
1777
+
1778
+ describe('#listvaultconfigurationsbyprovider - errors', () => {
1779
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1780
+ try {
1781
+ a.listvaultconfigurationsbyprovider(administrationVaultId, (data, error) => {
1782
+ try {
1783
+ if (stub) {
1784
+ const displayE = 'Error 400 received on request';
1785
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1786
+ } else {
1787
+ runCommonAsserts(data, error);
1788
+ }
1789
+ saveMockData('Administration', 'listvaultconfigurationsbyprovider', 'default', data);
1790
+ done();
1791
+ } catch (err) {
1792
+ log.error(`Test Failure: ${err}`);
1793
+ done(err);
1794
+ }
1795
+ });
1796
+ } catch (error) {
1797
+ log.error(`Adapter Exception: ${error}`);
1798
+ done(error);
1799
+ }
1800
+ }).timeout(attemptTimeout);
1801
+ });
1802
+
1803
+ const administrationVaultConfigurationId = 555;
1804
+ const administrationUpdatevaultconfigurationBodyParam = {
1805
+ address: '127.0.0.1',
1806
+ port: 8200,
1807
+ role_id: 'string',
1808
+ secret_id: 'string'
1809
+ };
1810
+ describe('#updatevaultconfiguration - errors', () => {
1811
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1812
+ try {
1813
+ a.updatevaultconfiguration(administrationVaultId, administrationVaultConfigurationId, administrationUpdatevaultconfigurationBodyParam, (data, error) => {
1814
+ try {
1815
+ if (stub) {
1816
+ const displayE = 'Error 400 received on request';
1817
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1818
+ } else {
1819
+ runCommonAsserts(data, error);
1820
+ }
1821
+ saveMockData('Administration', 'updatevaultconfiguration', 'default', data);
1822
+ done();
1823
+ } catch (err) {
1824
+ log.error(`Test Failure: ${err}`);
1825
+ done(err);
1826
+ }
1827
+ });
1828
+ } catch (error) {
1829
+ log.error(`Adapter Exception: ${error}`);
1830
+ done(error);
1831
+ }
1832
+ }).timeout(attemptTimeout);
1833
+ });
1834
+
1835
+ describe('#listonevaultconfigurationbyitsid - errors', () => {
1836
+ it('should work if integrated or standalone with mockdata', (done) => {
1837
+ try {
1838
+ a.listonevaultconfigurationbyitsid(administrationVaultId, administrationVaultConfigurationId, (data, error) => {
1839
+ try {
1840
+ if (stub) {
1841
+ runCommonAsserts(data, error);
1842
+ assert.equal(1, data.response.id);
1843
+ assert.equal('centreon_vault', data.response.name);
1844
+ assert.equal(1, data.response.vaultId);
1845
+ assert.equal('127.0.0.1', data.response.address);
1846
+ assert.equal(8200, data.response.port);
1847
+ assert.equal('centreon', data.response.root_path);
1848
+ assert.equal('string', data.response.role_id);
1849
+ } else {
1850
+ runCommonAsserts(data, error);
1851
+ }
1852
+ saveMockData('Administration', 'listonevaultconfigurationbyitsid', 'default', data);
1853
+ done();
1854
+ } catch (err) {
1855
+ log.error(`Test Failure: ${err}`);
1856
+ done(err);
1857
+ }
1858
+ });
1859
+ } catch (error) {
1860
+ log.error(`Adapter Exception: ${error}`);
1861
+ done(error);
1862
+ }
1863
+ }).timeout(attemptTimeout);
1864
+ });
1865
+
1866
+ describe('#logoutSession - errors', () => {
1867
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1868
+ try {
1869
+ a.logoutSession((data, error) => {
1870
+ try {
1871
+ if (stub) {
1872
+ const displayE = 'Error 400 received on request';
1873
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1874
+ } else {
1875
+ runCommonAsserts(data, error);
1876
+ }
1877
+ saveMockData('Authentication', 'logoutSession', 'default', data);
1878
+ done();
1879
+ } catch (err) {
1880
+ log.error(`Test Failure: ${err}`);
1881
+ done(err);
1882
+ }
1883
+ });
1884
+ } catch (error) {
1885
+ log.error(`Adapter Exception: ${error}`);
1886
+ done(error);
1887
+ }
1888
+ }).timeout(attemptTimeout);
1889
+ });
1890
+
1891
+ const authenticationProviderConfigurationName = 'fakedata';
1892
+ const authenticationAuthenticationtoproviderBodyParam = {
1893
+ login: 'admin',
1894
+ password: 'centreon'
1895
+ };
1896
+ describe('#authenticationtoprovider - errors', () => {
1897
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1898
+ try {
1899
+ a.authenticationtoprovider(authenticationProviderConfigurationName, authenticationAuthenticationtoproviderBodyParam, (data, error) => {
1900
+ try {
1901
+ if (stub) {
1902
+ const displayE = 'Error 400 received on request';
1903
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1904
+ } else {
1905
+ runCommonAsserts(data, error);
1906
+ }
1907
+ saveMockData('Authentication', 'authenticationtoprovider', 'default', data);
1908
+ done();
1909
+ } catch (err) {
1910
+ log.error(`Test Failure: ${err}`);
1911
+ done(err);
1912
+ }
1913
+ });
1914
+ } catch (error) {
1915
+ log.error(`Adapter Exception: ${error}`);
1916
+ done(error);
1917
+ }
1918
+ }).timeout(attemptTimeout);
1919
+ });
1920
+
1921
+ const authenticationLoginBodyParam = {};
1922
+ describe('#login - errors', () => {
1923
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1924
+ try {
1925
+ a.login(authenticationLoginBodyParam, (data, error) => {
1926
+ try {
1927
+ if (stub) {
1928
+ const displayE = 'Error 400 received on request';
1929
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1930
+ } else {
1931
+ runCommonAsserts(data, error);
1932
+ }
1933
+ saveMockData('Authentication', 'login', 'default', data);
1934
+ done();
1935
+ } catch (err) {
1936
+ log.error(`Test Failure: ${err}`);
1937
+ done(err);
1938
+ }
1939
+ });
1940
+ } catch (error) {
1941
+ log.error(`Adapter Exception: ${error}`);
1942
+ done(error);
1943
+ }
1944
+ }).timeout(attemptTimeout);
1945
+ });
1946
+
1947
+ describe('#providersConfigurations - errors', () => {
1948
+ it('should work if integrated or standalone with mockdata', (done) => {
1949
+ try {
1950
+ a.providersConfigurations((data, error) => {
1951
+ try {
1952
+ if (stub) {
1953
+ runCommonAsserts(data, error);
1954
+ assert.equal('object', typeof data.response[0]);
1955
+ assert.equal('object', typeof data.response[1]);
1956
+ assert.equal('object', typeof data.response[2]);
1957
+ } else {
1958
+ runCommonAsserts(data, error);
1959
+ }
1960
+ saveMockData('Authentication', 'providersConfigurations', 'default', data);
1961
+ done();
1962
+ } catch (err) {
1963
+ log.error(`Test Failure: ${err}`);
1964
+ done(err);
1965
+ }
1966
+ });
1967
+ } catch (error) {
1968
+ log.error(`Adapter Exception: ${error}`);
1969
+ done(error);
1970
+ }
1971
+ }).timeout(attemptTimeout);
1972
+ });
1973
+
1974
+ const authenticationAlias = 'fakedata';
1975
+ const authenticationUpdateuserpasswordBodyParam = {
1976
+ old_password: 'Centreon!2021',
1977
+ new_password: 'Centreon!2022'
1978
+ };
1979
+ describe('#updateuserpassword - errors', () => {
1980
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1981
+ try {
1982
+ a.updateuserpassword(authenticationAlias, authenticationUpdateuserpasswordBodyParam, (data, error) => {
1983
+ try {
1984
+ if (stub) {
1985
+ const displayE = 'Error 400 received on request';
1986
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
1987
+ } else {
1988
+ runCommonAsserts(data, error);
1989
+ }
1990
+ saveMockData('Authentication', 'updateuserpassword', 'default', data);
1991
+ done();
1992
+ } catch (err) {
1993
+ log.error(`Test Failure: ${err}`);
1994
+ done(err);
1995
+ }
1996
+ });
1997
+ } catch (error) {
1998
+ log.error(`Adapter Exception: ${error}`);
1999
+ done(error);
2000
+ }
2001
+ }).timeout(attemptTimeout);
2002
+ });
2003
+
2004
+ describe('#logout - errors', () => {
2005
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2006
+ try {
2007
+ a.logout((data, error) => {
2008
+ try {
2009
+ if (stub) {
2010
+ const displayE = 'Error 400 received on request';
2011
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2012
+ } else {
2013
+ runCommonAsserts(data, error);
2014
+ }
2015
+ saveMockData('Authentication', 'logout', 'default', data);
2016
+ done();
2017
+ } catch (err) {
2018
+ log.error(`Test Failure: ${err}`);
2019
+ done(err);
2020
+ }
2021
+ });
2022
+ } catch (error) {
2023
+ log.error(`Adapter Exception: ${error}`);
2024
+ done(error);
2025
+ }
2026
+ }).timeout(attemptTimeout);
2027
+ });
2028
+
2029
+ const gorgonePollerId = 555;
2030
+ const gorgoneCommandName = 'fakedata';
2031
+ describe('#gorgonecommandonspecificpoller - errors', () => {
2032
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2033
+ try {
2034
+ a.gorgonecommandonspecificpoller(gorgonePollerId, gorgoneCommandName, (data, error) => {
2035
+ try {
2036
+ if (stub) {
2037
+ const displayE = 'Error 400 received on request';
2038
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2039
+ } else {
2040
+ runCommonAsserts(data, error);
2041
+ }
2042
+ saveMockData('Gorgone', 'gorgonecommandonspecificpoller', 'default', data);
2043
+ done();
2044
+ } catch (err) {
2045
+ log.error(`Test Failure: ${err}`);
2046
+ done(err);
2047
+ }
2048
+ });
2049
+ } catch (error) {
2050
+ log.error(`Adapter Exception: ${error}`);
2051
+ done(error);
2052
+ }
2053
+ }).timeout(attemptTimeout);
2054
+ });
2055
+
2056
+ const gorgoneToken = 'fakedata';
2057
+ describe('#gorgonepollerresponsestoken - errors', () => {
2058
+ it('should work if integrated or standalone with mockdata', (done) => {
2059
+ try {
2060
+ a.gorgonepollerresponsestoken(gorgonePollerId, gorgoneToken, (data, error) => {
2061
+ try {
2062
+ if (stub) {
2063
+ runCommonAsserts(data, error);
2064
+ assert.equal('object', typeof data.response[0]);
2065
+ assert.equal('object', typeof data.response[1]);
2066
+ assert.equal('object', typeof data.response[2]);
2067
+ } else {
2068
+ runCommonAsserts(data, error);
2069
+ }
2070
+ saveMockData('Gorgone', 'gorgonepollerresponsestoken', 'default', data);
2071
+ done();
2072
+ } catch (err) {
2073
+ log.error(`Test Failure: ${err}`);
2074
+ done(err);
2075
+ }
2076
+ });
2077
+ } catch (error) {
2078
+ log.error(`Adapter Exception: ${error}`);
2079
+ done(error);
2080
+ }
2081
+ }).timeout(attemptTimeout);
2082
+ });
2083
+
2084
+ describe('#listallhosts - errors', () => {
2085
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2086
+ try {
2087
+ a.listallhosts(null, null, null, null, null, (data, error) => {
2088
+ try {
2089
+ if (stub) {
2090
+ const displayE = 'Error 400 received on request';
2091
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2092
+ } else {
2093
+ runCommonAsserts(data, error);
2094
+ }
2095
+ saveMockData('Host', 'listallhosts', 'default', data);
2096
+ done();
2097
+ } catch (err) {
2098
+ log.error(`Test Failure: ${err}`);
2099
+ done(err);
2100
+ }
2101
+ });
2102
+ } catch (error) {
2103
+ log.error(`Adapter Exception: ${error}`);
2104
+ done(error);
2105
+ }
2106
+ }).timeout(attemptTimeout);
2107
+ });
2108
+
2109
+ const hostHostId = 555;
2110
+ describe('#getahost - errors', () => {
2111
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2112
+ try {
2113
+ a.getahost(hostHostId, (data, error) => {
2114
+ try {
2115
+ if (stub) {
2116
+ const displayE = 'Error 400 received on request';
2117
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2118
+ } else {
2119
+ runCommonAsserts(data, error);
2120
+ }
2121
+ saveMockData('Host', 'getahost', 'default', data);
2122
+ done();
2123
+ } catch (err) {
2124
+ log.error(`Test Failure: ${err}`);
2125
+ done(err);
2126
+ }
2127
+ });
2128
+ } catch (error) {
2129
+ log.error(`Adapter Exception: ${error}`);
2130
+ done(error);
2131
+ }
2132
+ }).timeout(attemptTimeout);
2133
+ });
2134
+
2135
+ const hostCategoryCreateahostcategoryBodyParam = {
2136
+ name: 'host-category',
2137
+ alias: 'host-category',
2138
+ is_activated: true,
2139
+ comment: 'string'
2140
+ };
2141
+ describe('#createahostcategory - errors', () => {
2142
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2143
+ try {
2144
+ a.createahostcategory(hostCategoryCreateahostcategoryBodyParam, (data, error) => {
2145
+ try {
2146
+ if (stub) {
2147
+ const displayE = 'Error 400 received on request';
2148
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2149
+ } else {
2150
+ runCommonAsserts(data, error);
2151
+ }
2152
+ saveMockData('HostCategory', 'createahostcategory', 'default', data);
2153
+ done();
2154
+ } catch (err) {
2155
+ log.error(`Test Failure: ${err}`);
2156
+ done(err);
2157
+ }
2158
+ });
2159
+ } catch (error) {
2160
+ log.error(`Adapter Exception: ${error}`);
2161
+ done(error);
2162
+ }
2163
+ }).timeout(attemptTimeout);
2164
+ });
2165
+
2166
+ describe('#listhostcategories - errors', () => {
2167
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2168
+ try {
2169
+ a.listhostcategories((data, error) => {
2170
+ try {
2171
+ if (stub) {
2172
+ const displayE = 'Error 400 received on request';
2173
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2174
+ } else {
2175
+ runCommonAsserts(data, error);
2176
+ }
2177
+ saveMockData('HostCategory', 'listhostcategories', 'default', data);
2178
+ done();
2179
+ } catch (err) {
2180
+ log.error(`Test Failure: ${err}`);
2181
+ done(err);
2182
+ }
2183
+ });
2184
+ } catch (error) {
2185
+ log.error(`Adapter Exception: ${error}`);
2186
+ done(error);
2187
+ }
2188
+ }).timeout(attemptTimeout);
2189
+ });
2190
+
2191
+ describe('#listallrealTimehostcategories - errors', () => {
2192
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2193
+ try {
2194
+ a.listallrealTimehostcategories((data, error) => {
2195
+ try {
2196
+ if (stub) {
2197
+ const displayE = 'Error 400 received on request';
2198
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2199
+ } else {
2200
+ runCommonAsserts(data, error);
2201
+ }
2202
+ saveMockData('HostCategory', 'listallrealTimehostcategories', 'default', data);
2203
+ done();
2204
+ } catch (err) {
2205
+ log.error(`Test Failure: ${err}`);
2206
+ done(err);
2207
+ }
2208
+ });
2209
+ } catch (error) {
2210
+ log.error(`Adapter Exception: ${error}`);
2211
+ done(error);
2212
+ }
2213
+ }).timeout(attemptTimeout);
2214
+ });
2215
+
2216
+ const hostGroupAddahostgroupBodyParam = {
2217
+ name: 'MySQL-Servers',
2218
+ alias: 'All MySQL Servers',
2219
+ notes: 'my notes',
2220
+ notes_url: 'notes url',
2221
+ action_url: 'action url',
2222
+ icon_id: 1,
2223
+ icon_map_id: 1,
2224
+ geo_coords: '48.51,2.20',
2225
+ rrd: 2,
2226
+ comment: 'string',
2227
+ is_activated: true
2228
+ };
2229
+ describe('#addahostgroup - errors', () => {
2230
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2231
+ try {
2232
+ a.addahostgroup(hostGroupAddahostgroupBodyParam, (data, error) => {
2233
+ try {
2234
+ if (stub) {
2235
+ const displayE = 'Error 400 received on request';
2236
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2237
+ } else {
2238
+ runCommonAsserts(data, error);
2239
+ }
2240
+ saveMockData('HostGroup', 'addahostgroup', 'default', data);
2241
+ done();
2242
+ } catch (err) {
2243
+ log.error(`Test Failure: ${err}`);
2244
+ done(err);
2245
+ }
2246
+ });
2247
+ } catch (error) {
2248
+ log.error(`Adapter Exception: ${error}`);
2249
+ done(error);
2250
+ }
2251
+ }).timeout(attemptTimeout);
2252
+ });
2253
+
2254
+ describe('#listallhostgroups - errors', () => {
2255
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2256
+ try {
2257
+ a.listallhostgroups((data, error) => {
2258
+ try {
2259
+ if (stub) {
2260
+ const displayE = 'Error 400 received on request';
2261
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2262
+ } else {
2263
+ runCommonAsserts(data, error);
2264
+ }
2265
+ saveMockData('HostGroup', 'listallhostgroups', 'default', data);
2266
+ done();
2267
+ } catch (err) {
2268
+ log.error(`Test Failure: ${err}`);
2269
+ done(err);
2270
+ }
2271
+ });
2272
+ } catch (error) {
2273
+ log.error(`Adapter Exception: ${error}`);
2274
+ done(error);
2275
+ }
2276
+ }).timeout(attemptTimeout);
2277
+ });
2278
+
2279
+ describe('#getListallhostgroups - errors', () => {
2280
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2281
+ try {
2282
+ a.getListallhostgroups(null, null, null, null, null, null, (data, error) => {
2283
+ try {
2284
+ if (stub) {
2285
+ const displayE = 'Error 400 received on request';
2286
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2287
+ } else {
2288
+ runCommonAsserts(data, error);
2289
+ }
2290
+ saveMockData('HostGroup', 'getListallhostgroups', 'default', data);
2291
+ done();
2292
+ } catch (err) {
2293
+ log.error(`Test Failure: ${err}`);
2294
+ done(err);
2295
+ }
2296
+ });
2297
+ } catch (error) {
2298
+ log.error(`Adapter Exception: ${error}`);
2299
+ done(error);
2300
+ }
2301
+ }).timeout(attemptTimeout);
2302
+ });
2303
+
2304
+ const hostGroupHostId = 555;
2305
+ describe('#listallhostgroupsbyhostid - errors', () => {
2306
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2307
+ try {
2308
+ a.listallhostgroupsbyhostid(hostGroupHostId, null, null, null, (data, error) => {
2309
+ try {
2310
+ if (stub) {
2311
+ const displayE = 'Error 400 received on request';
2312
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2313
+ } else {
2314
+ runCommonAsserts(data, error);
2315
+ }
2316
+ saveMockData('HostGroup', 'listallhostgroupsbyhostid', 'default', data);
2317
+ done();
2318
+ } catch (err) {
2319
+ log.error(`Test Failure: ${err}`);
2320
+ done(err);
2321
+ }
2322
+ });
2323
+ } catch (error) {
2324
+ log.error(`Adapter Exception: ${error}`);
2325
+ done(error);
2326
+ }
2327
+ }).timeout(attemptTimeout);
2328
+ });
2329
+
2330
+ const hostSeverityCreateahostseverityBodyParam = {
2331
+ name: 'host-severity-name',
2332
+ alias: 'host-severity-alias',
2333
+ level: 2,
2334
+ icon_id: 1
2335
+ };
2336
+ describe('#createahostseverity - errors', () => {
2337
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2338
+ try {
2339
+ a.createahostseverity(hostSeverityCreateahostseverityBodyParam, (data, error) => {
2340
+ try {
2341
+ if (stub) {
2342
+ const displayE = 'Error 400 received on request';
2343
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2344
+ } else {
2345
+ runCommonAsserts(data, error);
2346
+ }
2347
+ saveMockData('HostSeverity', 'createahostseverity', 'default', data);
2348
+ done();
2349
+ } catch (err) {
2350
+ log.error(`Test Failure: ${err}`);
2351
+ done(err);
2352
+ }
2353
+ });
2354
+ } catch (error) {
2355
+ log.error(`Adapter Exception: ${error}`);
2356
+ done(error);
2357
+ }
2358
+ }).timeout(attemptTimeout);
2359
+ });
2360
+
2361
+ describe('#listallhostseverities - errors', () => {
2362
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2363
+ try {
2364
+ a.listallhostseverities((data, error) => {
2365
+ try {
2366
+ if (stub) {
2367
+ const displayE = 'Error 400 received on request';
2368
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2369
+ } else {
2370
+ runCommonAsserts(data, error);
2371
+ }
2372
+ saveMockData('HostSeverity', 'listallhostseverities', 'default', data);
2373
+ done();
2374
+ } catch (err) {
2375
+ log.error(`Test Failure: ${err}`);
2376
+ done(err);
2377
+ }
2378
+ });
2379
+ } catch (error) {
2380
+ log.error(`Adapter Exception: ${error}`);
2381
+ done(error);
2382
+ }
2383
+ }).timeout(attemptTimeout);
2384
+ });
2385
+
2386
+ describe('#listallhosttemplates - errors', () => {
2387
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2388
+ try {
2389
+ a.listallhosttemplates((data, error) => {
2390
+ try {
2391
+ if (stub) {
2392
+ const displayE = 'Error 400 received on request';
2393
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2394
+ } else {
2395
+ runCommonAsserts(data, error);
2396
+ }
2397
+ saveMockData('HostTemplate', 'listallhosttemplates', 'default', data);
2398
+ done();
2399
+ } catch (err) {
2400
+ log.error(`Test Failure: ${err}`);
2401
+ done(err);
2402
+ }
2403
+ });
2404
+ } catch (error) {
2405
+ log.error(`Adapter Exception: ${error}`);
2406
+ done(error);
2407
+ }
2408
+ }).timeout(attemptTimeout);
2409
+ });
2410
+
2411
+ describe('#listallmonitoringserversconfigurations - errors', () => {
2412
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2413
+ try {
2414
+ a.listallmonitoringserversconfigurations(null, null, null, null, (data, error) => {
2415
+ try {
2416
+ if (stub) {
2417
+ const displayE = 'Error 400 received on request';
2418
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2419
+ } else {
2420
+ runCommonAsserts(data, error);
2421
+ }
2422
+ saveMockData('MonitoringServer', 'listallmonitoringserversconfigurations', 'default', data);
2423
+ done();
2424
+ } catch (err) {
2425
+ log.error(`Test Failure: ${err}`);
2426
+ done(err);
2427
+ }
2428
+ });
2429
+ } catch (error) {
2430
+ log.error(`Adapter Exception: ${error}`);
2431
+ done(error);
2432
+ }
2433
+ }).timeout(attemptTimeout);
2434
+ });
2435
+
2436
+ describe('#generatetheconfigurationforallmonitoringservers - errors', () => {
2437
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2438
+ try {
2439
+ a.generatetheconfigurationforallmonitoringservers((data, error) => {
2440
+ try {
2441
+ if (stub) {
2442
+ const displayE = 'Error 400 received on request';
2443
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2444
+ } else {
2445
+ runCommonAsserts(data, error);
2446
+ }
2447
+ saveMockData('MonitoringServer', 'generatetheconfigurationforallmonitoringservers', 'default', data);
2448
+ done();
2449
+ } catch (err) {
2450
+ log.error(`Test Failure: ${err}`);
2451
+ done(err);
2452
+ }
2453
+ });
2454
+ } catch (error) {
2455
+ log.error(`Adapter Exception: ${error}`);
2456
+ done(error);
2457
+ }
2458
+ }).timeout(attemptTimeout);
2459
+ });
2460
+
2461
+ describe('#generateandreloadtheconfigurationforallmonitoringservers - errors', () => {
2462
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2463
+ try {
2464
+ a.generateandreloadtheconfigurationforallmonitoringservers((data, error) => {
2465
+ try {
2466
+ if (stub) {
2467
+ const displayE = 'Error 400 received on request';
2468
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2469
+ } else {
2470
+ runCommonAsserts(data, error);
2471
+ }
2472
+ saveMockData('MonitoringServer', 'generateandreloadtheconfigurationforallmonitoringservers', 'default', data);
2473
+ done();
2474
+ } catch (err) {
2475
+ log.error(`Test Failure: ${err}`);
2476
+ done(err);
2477
+ }
2478
+ });
2479
+ } catch (error) {
2480
+ log.error(`Adapter Exception: ${error}`);
2481
+ done(error);
2482
+ }
2483
+ }).timeout(attemptTimeout);
2484
+ });
2485
+
2486
+ describe('#reloadtheconfigurationforallmonitoringservers - errors', () => {
2487
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2488
+ try {
2489
+ a.reloadtheconfigurationforallmonitoringservers((data, error) => {
2490
+ try {
2491
+ if (stub) {
2492
+ const displayE = 'Error 400 received on request';
2493
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2494
+ } else {
2495
+ runCommonAsserts(data, error);
2496
+ }
2497
+ saveMockData('MonitoringServer', 'reloadtheconfigurationforallmonitoringservers', 'default', data);
2498
+ done();
2499
+ } catch (err) {
2500
+ log.error(`Test Failure: ${err}`);
2501
+ done(err);
2502
+ }
2503
+ });
2504
+ } catch (error) {
2505
+ log.error(`Adapter Exception: ${error}`);
2506
+ done(error);
2507
+ }
2508
+ }).timeout(attemptTimeout);
2509
+ });
2510
+
2511
+ const monitoringServerMonitoringServerId = 555;
2512
+ describe('#generatetheconfigurationofthemonitoringserver - errors', () => {
2513
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2514
+ try {
2515
+ a.generatetheconfigurationofthemonitoringserver(monitoringServerMonitoringServerId, (data, error) => {
2516
+ try {
2517
+ if (stub) {
2518
+ const displayE = 'Error 400 received on request';
2519
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2520
+ } else {
2521
+ runCommonAsserts(data, error);
2522
+ }
2523
+ saveMockData('MonitoringServer', 'generatetheconfigurationofthemonitoringserver', 'default', data);
2524
+ done();
2525
+ } catch (err) {
2526
+ log.error(`Test Failure: ${err}`);
2527
+ done(err);
2528
+ }
2529
+ });
2530
+ } catch (error) {
2531
+ log.error(`Adapter Exception: ${error}`);
2532
+ done(error);
2533
+ }
2534
+ }).timeout(attemptTimeout);
2535
+ });
2536
+
2537
+ describe('#generateandreloadtheconfigurationofthemonitoringserver - errors', () => {
2538
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2539
+ try {
2540
+ a.generateandreloadtheconfigurationofthemonitoringserver(monitoringServerMonitoringServerId, (data, error) => {
2541
+ try {
2542
+ if (stub) {
2543
+ const displayE = 'Error 400 received on request';
2544
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2545
+ } else {
2546
+ runCommonAsserts(data, error);
2547
+ }
2548
+ saveMockData('MonitoringServer', 'generateandreloadtheconfigurationofthemonitoringserver', 'default', data);
2549
+ done();
2550
+ } catch (err) {
2551
+ log.error(`Test Failure: ${err}`);
2552
+ done(err);
2553
+ }
2554
+ });
2555
+ } catch (error) {
2556
+ log.error(`Adapter Exception: ${error}`);
2557
+ done(error);
2558
+ }
2559
+ }).timeout(attemptTimeout);
2560
+ });
2561
+
2562
+ describe('#reloadtheconfigurationofthemonitoringserver - errors', () => {
2563
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2564
+ try {
2565
+ a.reloadtheconfigurationofthemonitoringserver(monitoringServerMonitoringServerId, (data, error) => {
2566
+ try {
2567
+ if (stub) {
2568
+ const displayE = 'Error 400 received on request';
2569
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2570
+ } else {
2571
+ runCommonAsserts(data, error);
2572
+ }
2573
+ saveMockData('MonitoringServer', 'reloadtheconfigurationofthemonitoringserver', 'default', data);
2574
+ done();
2575
+ } catch (err) {
2576
+ log.error(`Test Failure: ${err}`);
2577
+ done(err);
2578
+ }
2579
+ });
2580
+ } catch (error) {
2581
+ log.error(`Adapter Exception: ${error}`);
2582
+ done(error);
2583
+ }
2584
+ }).timeout(attemptTimeout);
2585
+ });
2586
+
2587
+ describe('#listallrealtimemonitoringservers - errors', () => {
2588
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2589
+ try {
2590
+ a.listallrealtimemonitoringservers(null, null, null, null, (data, error) => {
2591
+ try {
2592
+ if (stub) {
2593
+ const displayE = 'Error 400 received on request';
2594
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2595
+ } else {
2596
+ runCommonAsserts(data, error);
2597
+ }
2598
+ saveMockData('MonitoringServer', 'listallrealtimemonitoringservers', 'default', data);
2599
+ done();
2600
+ } catch (err) {
2601
+ log.error(`Test Failure: ${err}`);
2602
+ done(err);
2603
+ }
2604
+ });
2605
+ } catch (error) {
2606
+ log.error(`Adapter Exception: ${error}`);
2607
+ done(error);
2608
+ }
2609
+ }).timeout(attemptTimeout);
2610
+ });
2611
+
2612
+ const proxyUpdatethedefaultconfigurationoftheCentreonproxyBodyParam = {
2613
+ url: 'proxy.internal.company.org',
2614
+ port: 3128,
2615
+ user: 'proxy-user',
2616
+ password: 'proxy-pass'
2617
+ };
2618
+ describe('#updatethedefaultconfigurationoftheCentreonproxy - errors', () => {
2619
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2620
+ try {
2621
+ a.updatethedefaultconfigurationoftheCentreonproxy(proxyUpdatethedefaultconfigurationoftheCentreonproxyBodyParam, (data, error) => {
2622
+ try {
2623
+ if (stub) {
2624
+ const displayE = 'Error 400 received on request';
2625
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2626
+ } else {
2627
+ runCommonAsserts(data, error);
2628
+ }
2629
+ saveMockData('Proxy', 'updatethedefaultconfigurationoftheCentreonproxy', 'default', data);
2630
+ done();
2631
+ } catch (err) {
2632
+ log.error(`Test Failure: ${err}`);
2633
+ done(err);
2634
+ }
2635
+ });
2636
+ } catch (error) {
2637
+ log.error(`Adapter Exception: ${error}`);
2638
+ done(error);
2639
+ }
2640
+ }).timeout(attemptTimeout);
2641
+ });
2642
+
2643
+ describe('#displaythedefaultconfigurationoftheCentreonproxy - errors', () => {
2644
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2645
+ try {
2646
+ a.displaythedefaultconfigurationoftheCentreonproxy((data, error) => {
2647
+ try {
2648
+ if (stub) {
2649
+ const displayE = 'Error 400 received on request';
2650
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2651
+ } else {
2652
+ runCommonAsserts(data, error);
2653
+ }
2654
+ saveMockData('Proxy', 'displaythedefaultconfigurationoftheCentreonproxy', 'default', data);
2655
+ done();
2656
+ } catch (err) {
2657
+ log.error(`Test Failure: ${err}`);
2658
+ done(err);
2659
+ }
2660
+ });
2661
+ } catch (error) {
2662
+ log.error(`Adapter Exception: ${error}`);
2663
+ done(error);
2664
+ }
2665
+ }).timeout(attemptTimeout);
2666
+ });
2667
+
2668
+ const serviceHostId = 555;
2669
+ describe('#listservicesrelatedtoahost - errors', () => {
2670
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2671
+ try {
2672
+ a.listservicesrelatedtoahost(serviceHostId, null, null, null, null, (data, error) => {
2673
+ try {
2674
+ if (stub) {
2675
+ const displayE = 'Error 400 received on request';
2676
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2677
+ } else {
2678
+ runCommonAsserts(data, error);
2679
+ }
2680
+ saveMockData('Service', 'listservicesrelatedtoahost', 'default', data);
2681
+ done();
2682
+ } catch (err) {
2683
+ log.error(`Test Failure: ${err}`);
2684
+ done(err);
2685
+ }
2686
+ });
2687
+ } catch (error) {
2688
+ log.error(`Adapter Exception: ${error}`);
2689
+ done(error);
2690
+ }
2691
+ }).timeout(attemptTimeout);
2692
+ });
2693
+
2694
+ const serviceServiceId = 555;
2695
+ describe('#getaservice - errors', () => {
2696
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2697
+ try {
2698
+ a.getaservice(serviceHostId, serviceServiceId, (data, error) => {
2699
+ try {
2700
+ if (stub) {
2701
+ const displayE = 'Error 400 received on request';
2702
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2703
+ } else {
2704
+ runCommonAsserts(data, error);
2705
+ }
2706
+ saveMockData('Service', 'getaservice', 'default', data);
2707
+ done();
2708
+ } catch (err) {
2709
+ log.error(`Test Failure: ${err}`);
2710
+ done(err);
2711
+ }
2712
+ });
2713
+ } catch (error) {
2714
+ log.error(`Adapter Exception: ${error}`);
2715
+ done(error);
2716
+ }
2717
+ }).timeout(attemptTimeout);
2718
+ });
2719
+
2720
+ describe('#listallservices - errors', () => {
2721
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2722
+ try {
2723
+ a.listallservices(null, null, null, null, (data, error) => {
2724
+ try {
2725
+ if (stub) {
2726
+ const displayE = 'Error 400 received on request';
2727
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2728
+ } else {
2729
+ runCommonAsserts(data, error);
2730
+ }
2731
+ saveMockData('Service', 'listallservices', 'default', data);
2732
+ done();
2733
+ } catch (err) {
2734
+ log.error(`Test Failure: ${err}`);
2735
+ done(err);
2736
+ }
2737
+ });
2738
+ } catch (error) {
2739
+ log.error(`Adapter Exception: ${error}`);
2740
+ done(error);
2741
+ }
2742
+ }).timeout(attemptTimeout);
2743
+ });
2744
+
2745
+ const serviceGroupAddaservicegroupBodyParam = {
2746
+ name: 'MySQL-Servers',
2747
+ alias: 'All MySQL Servers',
2748
+ geo_coords: '48.51,2.20',
2749
+ comment: 'string',
2750
+ is_activated: false
2751
+ };
2752
+ describe('#addaservicegroup - errors', () => {
2753
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2754
+ try {
2755
+ a.addaservicegroup(serviceGroupAddaservicegroupBodyParam, (data, error) => {
2756
+ try {
2757
+ if (stub) {
2758
+ const displayE = 'Error 400 received on request';
2759
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2760
+ } else {
2761
+ runCommonAsserts(data, error);
2762
+ }
2763
+ saveMockData('ServiceGroup', 'addaservicegroup', 'default', data);
2764
+ done();
2765
+ } catch (err) {
2766
+ log.error(`Test Failure: ${err}`);
2767
+ done(err);
2768
+ }
2769
+ });
2770
+ } catch (error) {
2771
+ log.error(`Adapter Exception: ${error}`);
2772
+ done(error);
2773
+ }
2774
+ }).timeout(attemptTimeout);
2775
+ });
2776
+
2777
+ describe('#listallservicegroups - errors', () => {
2778
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2779
+ try {
2780
+ a.listallservicegroups((data, error) => {
2781
+ try {
2782
+ if (stub) {
2783
+ const displayE = 'Error 400 received on request';
2784
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2785
+ } else {
2786
+ runCommonAsserts(data, error);
2787
+ }
2788
+ saveMockData('ServiceGroup', 'listallservicegroups', 'default', data);
2789
+ done();
2790
+ } catch (err) {
2791
+ log.error(`Test Failure: ${err}`);
2792
+ done(err);
2793
+ }
2794
+ });
2795
+ } catch (error) {
2796
+ log.error(`Adapter Exception: ${error}`);
2797
+ done(error);
2798
+ }
2799
+ }).timeout(attemptTimeout);
2800
+ });
2801
+
2802
+ const serviceGroupHostId = 555;
2803
+ const serviceGroupServiceId = 555;
2804
+ describe('#getservicegroupsbyhostidandserviceid - errors', () => {
2805
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2806
+ try {
2807
+ a.getservicegroupsbyhostidandserviceid(serviceGroupHostId, serviceGroupServiceId, (data, error) => {
2808
+ try {
2809
+ if (stub) {
2810
+ const displayE = 'Error 400 received on request';
2811
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2812
+ } else {
2813
+ runCommonAsserts(data, error);
2814
+ }
2815
+ saveMockData('ServiceGroup', 'getservicegroupsbyhostidandserviceid', 'default', data);
2816
+ done();
2817
+ } catch (err) {
2818
+ log.error(`Test Failure: ${err}`);
2819
+ done(err);
2820
+ }
2821
+ });
2822
+ } catch (error) {
2823
+ log.error(`Adapter Exception: ${error}`);
2824
+ done(error);
2825
+ }
2826
+ }).timeout(attemptTimeout);
2827
+ });
2828
+
2829
+ describe('#getListallservicegroups - errors', () => {
2830
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2831
+ try {
2832
+ a.getListallservicegroups(null, null, null, null, null, null, (data, error) => {
2833
+ try {
2834
+ if (stub) {
2835
+ const displayE = 'Error 400 received on request';
2836
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2837
+ } else {
2838
+ runCommonAsserts(data, error);
2839
+ }
2840
+ saveMockData('ServiceGroup', 'getListallservicegroups', 'default', data);
2841
+ done();
2842
+ } catch (err) {
2843
+ log.error(`Test Failure: ${err}`);
2844
+ done(err);
2845
+ }
2846
+ });
2847
+ } catch (error) {
2848
+ log.error(`Adapter Exception: ${error}`);
2849
+ done(error);
2850
+ }
2851
+ }).timeout(attemptTimeout);
2852
+ });
2853
+
2854
+ const serviceCategoryCreateaservicecategoryBodyParam = {
2855
+ name: 'service-category',
2856
+ alias: 'service-category',
2857
+ is_activated: true
2858
+ };
2859
+ describe('#createaservicecategory - errors', () => {
2860
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2861
+ try {
2862
+ a.createaservicecategory(serviceCategoryCreateaservicecategoryBodyParam, (data, error) => {
2863
+ try {
2864
+ if (stub) {
2865
+ const displayE = 'Error 400 received on request';
2866
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2867
+ } else {
2868
+ runCommonAsserts(data, error);
2869
+ }
2870
+ saveMockData('ServiceCategory', 'createaservicecategory', 'default', data);
2871
+ done();
2872
+ } catch (err) {
2873
+ log.error(`Test Failure: ${err}`);
2874
+ done(err);
2875
+ }
2876
+ });
2877
+ } catch (error) {
2878
+ log.error(`Adapter Exception: ${error}`);
2879
+ done(error);
2880
+ }
2881
+ }).timeout(attemptTimeout);
2882
+ });
2883
+
2884
+ describe('#listservicecategories - errors', () => {
2885
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2886
+ try {
2887
+ a.listservicecategories((data, error) => {
2888
+ try {
2889
+ if (stub) {
2890
+ const displayE = 'Error 400 received on request';
2891
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2892
+ } else {
2893
+ runCommonAsserts(data, error);
2894
+ }
2895
+ saveMockData('ServiceCategory', 'listservicecategories', 'default', data);
2896
+ done();
2897
+ } catch (err) {
2898
+ log.error(`Test Failure: ${err}`);
2899
+ done(err);
2900
+ }
2901
+ });
2902
+ } catch (error) {
2903
+ log.error(`Adapter Exception: ${error}`);
2904
+ done(error);
2905
+ }
2906
+ }).timeout(attemptTimeout);
2907
+ });
2908
+
2909
+ describe('#listallrealTimeservicecategories - errors', () => {
2910
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2911
+ try {
2912
+ a.listallrealTimeservicecategories((data, error) => {
2913
+ try {
2914
+ if (stub) {
2915
+ const displayE = 'Error 400 received on request';
2916
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2917
+ } else {
2918
+ runCommonAsserts(data, error);
2919
+ }
2920
+ saveMockData('ServiceCategory', 'listallrealTimeservicecategories', 'default', data);
2921
+ done();
2922
+ } catch (err) {
2923
+ log.error(`Test Failure: ${err}`);
2924
+ done(err);
2925
+ }
2926
+ });
2927
+ } catch (error) {
2928
+ log.error(`Adapter Exception: ${error}`);
2929
+ done(error);
2930
+ }
2931
+ }).timeout(attemptTimeout);
2932
+ });
2933
+
2934
+ describe('#listallhostseveritiesfromrealTimedata - errors', () => {
2935
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2936
+ try {
2937
+ a.listallhostseveritiesfromrealTimedata(null, null, null, null, (data, error) => {
2938
+ try {
2939
+ if (stub) {
2940
+ const displayE = 'Error 400 received on request';
2941
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2942
+ } else {
2943
+ runCommonAsserts(data, error);
2944
+ }
2945
+ saveMockData('Severity', 'listallhostseveritiesfromrealTimedata', 'default', data);
2946
+ done();
2947
+ } catch (err) {
2948
+ log.error(`Test Failure: ${err}`);
2949
+ done(err);
2950
+ }
2951
+ });
2952
+ } catch (error) {
2953
+ log.error(`Adapter Exception: ${error}`);
2954
+ done(error);
2955
+ }
2956
+ }).timeout(attemptTimeout);
2957
+ });
2958
+
2959
+ describe('#listallserviceseveritiesfromtherealtime - errors', () => {
2960
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2961
+ try {
2962
+ a.listallserviceseveritiesfromtherealtime(null, null, null, null, (data, error) => {
2963
+ try {
2964
+ if (stub) {
2965
+ const displayE = 'Error 400 received on request';
2966
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
2967
+ } else {
2968
+ runCommonAsserts(data, error);
2969
+ }
2970
+ saveMockData('Severity', 'listallserviceseveritiesfromtherealtime', 'default', data);
2971
+ done();
2972
+ } catch (err) {
2973
+ log.error(`Test Failure: ${err}`);
2974
+ done(err);
2975
+ }
2976
+ });
2977
+ } catch (error) {
2978
+ log.error(`Adapter Exception: ${error}`);
2979
+ done(error);
2980
+ }
2981
+ }).timeout(attemptTimeout);
2982
+ });
2983
+
2984
+ const timePeriodCreateanewtimeperiodBodyParam = {
2985
+ name: '24x7',
2986
+ alias: 'Always',
2987
+ days: [
2988
+ {
2989
+ day: 1,
2990
+ time_range: '00:00-06:00,07:00-08:00'
2991
+ }
2992
+ ],
2993
+ templates: [
2994
+ 2
2995
+ ],
2996
+ exceptions: [
2997
+ {
2998
+ day_range: 'monday 1',
2999
+ time_range: '00:00-06:00,07:00-08:00'
3000
+ }
3001
+ ]
3002
+ };
3003
+ describe('#createanewtimeperiod - errors', () => {
3004
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3005
+ try {
3006
+ a.createanewtimeperiod(timePeriodCreateanewtimeperiodBodyParam, (data, error) => {
3007
+ try {
3008
+ if (stub) {
3009
+ const displayE = 'Error 400 received on request';
3010
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3011
+ } else {
3012
+ runCommonAsserts(data, error);
3013
+ }
3014
+ saveMockData('TimePeriod', 'createanewtimeperiod', 'default', data);
3015
+ done();
3016
+ } catch (err) {
3017
+ log.error(`Test Failure: ${err}`);
3018
+ done(err);
3019
+ }
3020
+ });
3021
+ } catch (error) {
3022
+ log.error(`Adapter Exception: ${error}`);
3023
+ done(error);
3024
+ }
3025
+ }).timeout(attemptTimeout);
3026
+ });
3027
+
3028
+ describe('#getalltimeperiods - errors', () => {
3029
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3030
+ try {
3031
+ a.getalltimeperiods((data, error) => {
3032
+ try {
3033
+ if (stub) {
3034
+ const displayE = 'Error 400 received on request';
3035
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3036
+ } else {
3037
+ runCommonAsserts(data, error);
3038
+ }
3039
+ saveMockData('TimePeriod', 'getalltimeperiods', 'default', data);
3040
+ done();
3041
+ } catch (err) {
3042
+ log.error(`Test Failure: ${err}`);
3043
+ done(err);
3044
+ }
3045
+ });
3046
+ } catch (error) {
3047
+ log.error(`Adapter Exception: ${error}`);
3048
+ done(error);
3049
+ }
3050
+ }).timeout(attemptTimeout);
3051
+ });
3052
+
3053
+ const timePeriodId = 555;
3054
+ const timePeriodUpdateatimeperiodBodyParam = {
3055
+ name: '24x7',
3056
+ alias: 'Always',
3057
+ days: [
3058
+ {
3059
+ day: 1,
3060
+ time_range: '00:00-06:00,07:00-08:00'
3061
+ }
3062
+ ],
3063
+ templates: [
3064
+ 6
3065
+ ],
3066
+ exceptions: [
3067
+ {
3068
+ day_range: 'monday 1',
3069
+ time_range: '00:00-06:00,07:00-08:00'
3070
+ }
3071
+ ]
3072
+ };
3073
+ describe('#updateatimeperiod - errors', () => {
3074
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3075
+ try {
3076
+ a.updateatimeperiod(timePeriodId, timePeriodUpdateatimeperiodBodyParam, (data, error) => {
3077
+ try {
3078
+ if (stub) {
3079
+ const displayE = 'Error 400 received on request';
3080
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3081
+ } else {
3082
+ runCommonAsserts(data, error);
3083
+ }
3084
+ saveMockData('TimePeriod', 'updateatimeperiod', 'default', data);
3085
+ done();
3086
+ } catch (err) {
3087
+ log.error(`Test Failure: ${err}`);
3088
+ done(err);
3089
+ }
3090
+ });
3091
+ } catch (error) {
3092
+ log.error(`Adapter Exception: ${error}`);
3093
+ done(error);
3094
+ }
3095
+ }).timeout(attemptTimeout);
3096
+ });
3097
+
3098
+ describe('#getatimeperiod - errors', () => {
3099
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3100
+ try {
3101
+ a.getatimeperiod(timePeriodId, (data, error) => {
3102
+ try {
3103
+ if (stub) {
3104
+ const displayE = 'Error 400 received on request';
3105
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3106
+ } else {
3107
+ runCommonAsserts(data, error);
3108
+ }
3109
+ saveMockData('TimePeriod', 'getatimeperiod', 'default', data);
3110
+ done();
3111
+ } catch (err) {
3112
+ log.error(`Test Failure: ${err}`);
3113
+ done(err);
3114
+ }
3115
+ });
3116
+ } catch (error) {
3117
+ log.error(`Adapter Exception: ${error}`);
3118
+ done(error);
3119
+ }
3120
+ }).timeout(attemptTimeout);
3121
+ });
3122
+
3123
+ const topologyRegistertoplatformtopologyBodyParam = {
3124
+ name: 'myPoller',
3125
+ type: null,
3126
+ address: '1.1.1.2'
3127
+ };
3128
+ describe('#registertoplatformtopology - errors', () => {
3129
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3130
+ try {
3131
+ a.registertoplatformtopology(topologyRegistertoplatformtopologyBodyParam, (data, error) => {
3132
+ try {
3133
+ if (stub) {
3134
+ const displayE = 'Error 400 received on request';
3135
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3136
+ } else {
3137
+ runCommonAsserts(data, error);
3138
+ }
3139
+ saveMockData('Topology', 'registertoplatformtopology', 'default', data);
3140
+ done();
3141
+ } catch (err) {
3142
+ log.error(`Test Failure: ${err}`);
3143
+ done(err);
3144
+ }
3145
+ });
3146
+ } catch (error) {
3147
+ log.error(`Adapter Exception: ${error}`);
3148
+ done(error);
3149
+ }
3150
+ }).timeout(attemptTimeout);
3151
+ });
3152
+
3153
+ describe('#getaplatformtopology - errors', () => {
3154
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3155
+ try {
3156
+ a.getaplatformtopology((data, error) => {
3157
+ try {
3158
+ if (stub) {
3159
+ const displayE = 'Error 400 received on request';
3160
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3161
+ } else {
3162
+ runCommonAsserts(data, error);
3163
+ }
3164
+ saveMockData('Topology', 'getaplatformtopology', 'default', data);
3165
+ done();
3166
+ } catch (err) {
3167
+ log.error(`Test Failure: ${err}`);
3168
+ done(err);
3169
+ }
3170
+ });
3171
+ } catch (error) {
3172
+ log.error(`Adapter Exception: ${error}`);
3173
+ done(error);
3174
+ }
3175
+ }).timeout(attemptTimeout);
3176
+ });
3177
+
3178
+ const serviceSeverityCreateaserviceseverityBodyParam = {
3179
+ name: 'service-severity-name',
3180
+ alias: 'service-severity-alias',
3181
+ level: 2,
3182
+ icon_id: 1
3183
+ };
3184
+ describe('#createaserviceseverity - errors', () => {
3185
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3186
+ try {
3187
+ a.createaserviceseverity(serviceSeverityCreateaserviceseverityBodyParam, (data, error) => {
3188
+ try {
3189
+ if (stub) {
3190
+ const displayE = 'Error 400 received on request';
3191
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3192
+ } else {
3193
+ runCommonAsserts(data, error);
3194
+ }
3195
+ saveMockData('ServiceSeverity', 'createaserviceseverity', 'default', data);
3196
+ done();
3197
+ } catch (err) {
3198
+ log.error(`Test Failure: ${err}`);
3199
+ done(err);
3200
+ }
3201
+ });
3202
+ } catch (error) {
3203
+ log.error(`Adapter Exception: ${error}`);
3204
+ done(error);
3205
+ }
3206
+ }).timeout(attemptTimeout);
3207
+ });
3208
+
3209
+ describe('#listallserviceseverities - errors', () => {
3210
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3211
+ try {
3212
+ a.listallserviceseverities((data, error) => {
3213
+ try {
3214
+ if (stub) {
3215
+ const displayE = 'Error 400 received on request';
3216
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3217
+ } else {
3218
+ runCommonAsserts(data, error);
3219
+ }
3220
+ saveMockData('ServiceSeverity', 'listallserviceseverities', 'default', data);
3221
+ done();
3222
+ } catch (err) {
3223
+ log.error(`Test Failure: ${err}`);
3224
+ done(err);
3225
+ }
3226
+ });
3227
+ } catch (error) {
3228
+ log.error(`Adapter Exception: ${error}`);
3229
+ done(error);
3230
+ }
3231
+ }).timeout(attemptTimeout);
3232
+ });
3233
+
3234
+ describe('#listallicons - errors', () => {
3235
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3236
+ try {
3237
+ a.listallicons((data, error) => {
3238
+ try {
3239
+ if (stub) {
3240
+ const displayE = 'Error 400 received on request';
3241
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3242
+ } else {
3243
+ runCommonAsserts(data, error);
3244
+ }
3245
+ saveMockData('Icons', 'listallicons', 'default', data);
3246
+ done();
3247
+ } catch (err) {
3248
+ log.error(`Test Failure: ${err}`);
3249
+ done(err);
3250
+ }
3251
+ });
3252
+ } catch (error) {
3253
+ log.error(`Adapter Exception: ${error}`);
3254
+ done(error);
3255
+ }
3256
+ }).timeout(attemptTimeout);
3257
+ });
3258
+
3259
+ const notificationPolicyHostId = 555;
3260
+ describe('#getnotificationpolicyofahost - errors', () => {
3261
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3262
+ try {
3263
+ a.getnotificationpolicyofahost(notificationPolicyHostId, (data, error) => {
3264
+ try {
3265
+ if (stub) {
3266
+ const displayE = 'Error 400 received on request';
3267
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3268
+ } else {
3269
+ runCommonAsserts(data, error);
3270
+ }
3271
+ saveMockData('NotificationPolicy', 'getnotificationpolicyofahost', 'default', data);
3272
+ done();
3273
+ } catch (err) {
3274
+ log.error(`Test Failure: ${err}`);
3275
+ done(err);
3276
+ }
3277
+ });
3278
+ } catch (error) {
3279
+ log.error(`Adapter Exception: ${error}`);
3280
+ done(error);
3281
+ }
3282
+ }).timeout(attemptTimeout);
3283
+ });
3284
+
3285
+ const notificationPolicyServiceId = 555;
3286
+ describe('#getnotificationpolicyofaservice - errors', () => {
3287
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3288
+ try {
3289
+ a.getnotificationpolicyofaservice(notificationPolicyHostId, notificationPolicyServiceId, (data, error) => {
3290
+ try {
3291
+ if (stub) {
3292
+ const displayE = 'Error 400 received on request';
3293
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3294
+ } else {
3295
+ runCommonAsserts(data, error);
3296
+ }
3297
+ saveMockData('NotificationPolicy', 'getnotificationpolicyofaservice', 'default', data);
3298
+ done();
3299
+ } catch (err) {
3300
+ log.error(`Test Failure: ${err}`);
3301
+ done(err);
3302
+ }
3303
+ });
3304
+ } catch (error) {
3305
+ log.error(`Adapter Exception: ${error}`);
3306
+ done(error);
3307
+ }
3308
+ }).timeout(attemptTimeout);
3309
+ });
3310
+
3311
+ const notificationPolicyMetaId = 555;
3312
+ describe('#getnotificationpolicyofametaservice - errors', () => {
3313
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3314
+ try {
3315
+ a.getnotificationpolicyofametaservice(notificationPolicyMetaId, (data, error) => {
3316
+ try {
3317
+ if (stub) {
3318
+ const displayE = 'Error 400 received on request';
3319
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3320
+ } else {
3321
+ runCommonAsserts(data, error);
3322
+ }
3323
+ saveMockData('NotificationPolicy', 'getnotificationpolicyofametaservice', 'default', data);
3324
+ done();
3325
+ } catch (err) {
3326
+ log.error(`Test Failure: ${err}`);
3327
+ done(err);
3328
+ }
3329
+ });
3330
+ } catch (error) {
3331
+ log.error(`Adapter Exception: ${error}`);
3332
+ done(error);
3333
+ }
3334
+ }).timeout(attemptTimeout);
3335
+ });
3336
+
3337
+ describe('#listcontactgroups - errors', () => {
3338
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3339
+ try {
3340
+ a.listcontactgroups((data, error) => {
3341
+ try {
3342
+ if (stub) {
3343
+ const displayE = 'Error 400 received on request';
3344
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3345
+ } else {
3346
+ runCommonAsserts(data, error);
3347
+ }
3348
+ saveMockData('User', 'listcontactgroups', 'default', data);
3349
+ done();
3350
+ } catch (err) {
3351
+ log.error(`Test Failure: ${err}`);
3352
+ done(err);
3353
+ }
3354
+ });
3355
+ } catch (error) {
3356
+ log.error(`Adapter Exception: ${error}`);
3357
+ done(error);
3358
+ }
3359
+ }).timeout(attemptTimeout);
3360
+ });
3361
+
3362
+ describe('#listcontacttemplates - errors', () => {
3363
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3364
+ try {
3365
+ a.listcontacttemplates((data, error) => {
3366
+ try {
3367
+ if (stub) {
3368
+ const displayE = 'Error 400 received on request';
3369
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3370
+ } else {
3371
+ runCommonAsserts(data, error);
3372
+ }
3373
+ saveMockData('User', 'listcontacttemplates', 'default', data);
3374
+ done();
3375
+ } catch (err) {
3376
+ log.error(`Test Failure: ${err}`);
3377
+ done(err);
3378
+ }
3379
+ });
3380
+ } catch (error) {
3381
+ log.error(`Adapter Exception: ${error}`);
3382
+ done(error);
3383
+ }
3384
+ }).timeout(attemptTimeout);
3385
+ });
3386
+
3387
+ describe('#getconfiguredusers - errors', () => {
3388
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3389
+ try {
3390
+ a.getconfiguredusers((data, error) => {
3391
+ try {
3392
+ if (stub) {
3393
+ const displayE = 'Error 400 received on request';
3394
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3395
+ } else {
3396
+ runCommonAsserts(data, error);
3397
+ }
3398
+ saveMockData('User', 'getconfiguredusers', 'default', data);
3399
+ done();
3400
+ } catch (err) {
3401
+ log.error(`Test Failure: ${err}`);
3402
+ done(err);
3403
+ }
3404
+ });
3405
+ } catch (error) {
3406
+ log.error(`Adapter Exception: ${error}`);
3407
+ done(error);
3408
+ }
3409
+ }).timeout(attemptTimeout);
3410
+ });
3411
+
3412
+ const userUpdateauserBodyParam = {
3413
+ theme: null,
3414
+ user_interface_density: null
3415
+ };
3416
+ describe('#updateauser - errors', () => {
3417
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3418
+ try {
3419
+ a.updateauser(userUpdateauserBodyParam, (data, error) => {
3420
+ try {
3421
+ if (stub) {
3422
+ const displayE = 'Error 400 received on request';
3423
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3424
+ } else {
3425
+ runCommonAsserts(data, error);
3426
+ }
3427
+ saveMockData('User', 'updateauser', 'default', data);
3428
+ done();
3429
+ } catch (err) {
3430
+ log.error(`Test Failure: ${err}`);
3431
+ done(err);
3432
+ }
3433
+ });
3434
+ } catch (error) {
3435
+ log.error(`Adapter Exception: ${error}`);
3436
+ done(error);
3437
+ }
3438
+ }).timeout(attemptTimeout);
3439
+ });
3440
+
3441
+ describe('#listuserparameters - errors', () => {
3442
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3443
+ try {
3444
+ a.listuserparameters((data, error) => {
3445
+ try {
3446
+ if (stub) {
3447
+ const displayE = 'Error 400 received on request';
3448
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3449
+ } else {
3450
+ runCommonAsserts(data, error);
3451
+ }
3452
+ saveMockData('User', 'listuserparameters', 'default', data);
3453
+ done();
3454
+ } catch (err) {
3455
+ log.error(`Test Failure: ${err}`);
3456
+ done(err);
3457
+ }
3458
+ });
3459
+ } catch (error) {
3460
+ log.error(`Adapter Exception: ${error}`);
3461
+ done(error);
3462
+ }
3463
+ }).timeout(attemptTimeout);
3464
+ });
3465
+
3466
+ describe('#listallowedactions - errors', () => {
3467
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3468
+ try {
3469
+ a.listallowedactions((data, error) => {
3470
+ try {
3471
+ if (stub) {
3472
+ const displayE = 'Error 400 received on request';
3473
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3474
+ } else {
3475
+ runCommonAsserts(data, error);
3476
+ }
3477
+ saveMockData('User', 'listallowedactions', 'default', data);
3478
+ done();
3479
+ } catch (err) {
3480
+ log.error(`Test Failure: ${err}`);
3481
+ done(err);
3482
+ }
3483
+ });
3484
+ } catch (error) {
3485
+ log.error(`Adapter Exception: ${error}`);
3486
+ done(error);
3487
+ }
3488
+ }).timeout(attemptTimeout);
3489
+ });
3490
+
3491
+ const userPageName = 'fakedata';
3492
+ describe('#listuserfiltersbypage - errors', () => {
3493
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3494
+ try {
3495
+ a.listuserfiltersbypage(userPageName, (data, error) => {
3496
+ try {
3497
+ if (stub) {
3498
+ const displayE = 'Error 400 received on request';
3499
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3500
+ } else {
3501
+ runCommonAsserts(data, error);
3502
+ }
3503
+ saveMockData('User', 'listuserfiltersbypage', 'default', data);
3504
+ done();
3505
+ } catch (err) {
3506
+ log.error(`Test Failure: ${err}`);
3507
+ done(err);
3508
+ }
3509
+ });
3510
+ } catch (error) {
3511
+ log.error(`Adapter Exception: ${error}`);
3512
+ done(error);
3513
+ }
3514
+ }).timeout(attemptTimeout);
3515
+ });
3516
+
3517
+ const userFilterId = 555;
3518
+ describe('#detaileduserfilter - errors', () => {
3519
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3520
+ try {
3521
+ a.detaileduserfilter(userPageName, userFilterId, (data, error) => {
3522
+ try {
3523
+ if (stub) {
3524
+ const displayE = 'Error 400 received on request';
3525
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3526
+ } else {
3527
+ runCommonAsserts(data, error);
3528
+ }
3529
+ saveMockData('User', 'detaileduserfilter', 'default', data);
3530
+ done();
3531
+ } catch (err) {
3532
+ log.error(`Test Failure: ${err}`);
3533
+ done(err);
3534
+ }
3535
+ });
3536
+ } catch (error) {
3537
+ log.error(`Adapter Exception: ${error}`);
3538
+ done(error);
3539
+ }
3540
+ }).timeout(attemptTimeout);
3541
+ });
3542
+
3543
+ const userFiltersPageName = 'fakedata';
3544
+ const userFiltersAdduserfilterBodyParam = {
3545
+ name: 'my filter 1',
3546
+ criterias: [
3547
+ {}
3548
+ ]
3549
+ };
3550
+ describe('#adduserfilter - errors', () => {
3551
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3552
+ try {
3553
+ a.adduserfilter(userFiltersPageName, userFiltersAdduserfilterBodyParam, (data, error) => {
3554
+ try {
3555
+ if (stub) {
3556
+ const displayE = 'Error 400 received on request';
3557
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3558
+ } else {
3559
+ runCommonAsserts(data, error);
3560
+ }
3561
+ saveMockData('UserFilters', 'adduserfilter', 'default', data);
3562
+ done();
3563
+ } catch (err) {
3564
+ log.error(`Test Failure: ${err}`);
3565
+ done(err);
3566
+ }
3567
+ });
3568
+ } catch (error) {
3569
+ log.error(`Adapter Exception: ${error}`);
3570
+ done(error);
3571
+ }
3572
+ }).timeout(attemptTimeout);
3573
+ });
3574
+
3575
+ const userFiltersFilterId = 555;
3576
+ const userFiltersUpdateuserfilterBodyParam = {
3577
+ name: 'my filter 1',
3578
+ criterias: [
3579
+ {}
3580
+ ]
3581
+ };
3582
+ describe('#updateuserfilter - errors', () => {
3583
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3584
+ try {
3585
+ a.updateuserfilter(userFiltersPageName, userFiltersFilterId, userFiltersUpdateuserfilterBodyParam, (data, error) => {
3586
+ try {
3587
+ if (stub) {
3588
+ const displayE = 'Error 400 received on request';
3589
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3590
+ } else {
3591
+ runCommonAsserts(data, error);
3592
+ }
3593
+ saveMockData('UserFilters', 'updateuserfilter', 'default', data);
3594
+ done();
3595
+ } catch (err) {
3596
+ log.error(`Test Failure: ${err}`);
3597
+ done(err);
3598
+ }
3599
+ });
3600
+ } catch (error) {
3601
+ log.error(`Adapter Exception: ${error}`);
3602
+ done(error);
3603
+ }
3604
+ }).timeout(attemptTimeout);
3605
+ });
3606
+
3607
+ const userFiltersPatchuserfilterBodyParam = {
3608
+ order: 1
3609
+ };
3610
+ describe('#patchuserfilter - errors', () => {
3611
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3612
+ try {
3613
+ a.patchuserfilter(userFiltersPageName, userFiltersFilterId, userFiltersPatchuserfilterBodyParam, (data, error) => {
3614
+ try {
3615
+ if (stub) {
3616
+ const displayE = 'Error 400 received on request';
3617
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3618
+ } else {
3619
+ runCommonAsserts(data, error);
3620
+ }
3621
+ saveMockData('UserFilters', 'patchuserfilter', 'default', data);
3622
+ done();
3623
+ } catch (err) {
3624
+ log.error(`Test Failure: ${err}`);
3625
+ done(err);
3626
+ }
3627
+ });
3628
+ } catch (error) {
3629
+ log.error(`Adapter Exception: ${error}`);
3630
+ done(error);
3631
+ }
3632
+ }).timeout(attemptTimeout);
3633
+ });
3634
+
3635
+ describe('#listaccessgroups - errors', () => {
3636
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3637
+ try {
3638
+ a.listaccessgroups((data, error) => {
3639
+ try {
3640
+ if (stub) {
3641
+ const displayE = 'Error 400 received on request';
3642
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3643
+ } else {
3644
+ runCommonAsserts(data, error);
3645
+ }
3646
+ saveMockData('AccessControl', 'listaccessgroups', 'default', data);
3647
+ done();
3648
+ } catch (err) {
3649
+ log.error(`Test Failure: ${err}`);
3650
+ done(err);
3651
+ }
3652
+ });
3653
+ } catch (error) {
3654
+ log.error(`Adapter Exception: ${error}`);
3655
+ done(error);
3656
+ }
3657
+ }).timeout(attemptTimeout);
3658
+ });
3659
+
3660
+ describe('#listallresourcesincludinghostsandservices - errors', () => {
3661
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3662
+ try {
3663
+ a.listallresourcesincludinghostsandservices(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
3664
+ try {
3665
+ if (stub) {
3666
+ const displayE = 'Error 400 received on request';
3667
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3668
+ } else {
3669
+ runCommonAsserts(data, error);
3670
+ }
3671
+ saveMockData('Resource', 'listallresourcesincludinghostsandservices', 'default', data);
3672
+ done();
3673
+ } catch (err) {
3674
+ log.error(`Test Failure: ${err}`);
3675
+ done(err);
3676
+ }
3677
+ });
3678
+ } catch (error) {
3679
+ log.error(`Adapter Exception: ${error}`);
3680
+ done(error);
3681
+ }
3682
+ }).timeout(attemptTimeout);
3683
+ });
3684
+
3685
+ const resourceHostId = 555;
3686
+ describe('#getaHostresourcetypedetail - errors', () => {
3687
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3688
+ try {
3689
+ a.getaHostresourcetypedetail(resourceHostId, (data, error) => {
3690
+ try {
3691
+ if (stub) {
3692
+ const displayE = 'Error 400 received on request';
3693
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3694
+ } else {
3695
+ runCommonAsserts(data, error);
3696
+ }
3697
+ saveMockData('Resource', 'getaHostresourcetypedetail', 'default', data);
3698
+ done();
3699
+ } catch (err) {
3700
+ log.error(`Test Failure: ${err}`);
3701
+ done(err);
3702
+ }
3703
+ });
3704
+ } catch (error) {
3705
+ log.error(`Adapter Exception: ${error}`);
3706
+ done(error);
3707
+ }
3708
+ }).timeout(attemptTimeout);
3709
+ });
3710
+
3711
+ const resourceServiceId = 555;
3712
+ describe('#getaServiceresourcetypedetail - errors', () => {
3713
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3714
+ try {
3715
+ a.getaServiceresourcetypedetail(resourceHostId, resourceServiceId, (data, error) => {
3716
+ try {
3717
+ if (stub) {
3718
+ const displayE = 'Error 400 received on request';
3719
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3720
+ } else {
3721
+ runCommonAsserts(data, error);
3722
+ }
3723
+ saveMockData('Resource', 'getaServiceresourcetypedetail', 'default', data);
3724
+ done();
3725
+ } catch (err) {
3726
+ log.error(`Test Failure: ${err}`);
3727
+ done(err);
3728
+ }
3729
+ });
3730
+ } catch (error) {
3731
+ log.error(`Adapter Exception: ${error}`);
3732
+ done(error);
3733
+ }
3734
+ }).timeout(attemptTimeout);
3735
+ });
3736
+
3737
+ const commentAddcommenttoresourcesBodyParam = {
3738
+ resources: [
3739
+ {}
3740
+ ]
3741
+ };
3742
+ describe('#addcommenttoresources - errors', () => {
3743
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3744
+ try {
3745
+ a.addcommenttoresources(commentAddcommenttoresourcesBodyParam, (data, error) => {
3746
+ try {
3747
+ if (stub) {
3748
+ const displayE = 'Error 400 received on request';
3749
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3750
+ } else {
3751
+ runCommonAsserts(data, error);
3752
+ }
3753
+ saveMockData('Comment', 'addcommenttoresources', 'default', data);
3754
+ done();
3755
+ } catch (err) {
3756
+ log.error(`Test Failure: ${err}`);
3757
+ done(err);
3758
+ }
3759
+ });
3760
+ } catch (error) {
3761
+ log.error(`Adapter Exception: ${error}`);
3762
+ done(error);
3763
+ }
3764
+ }).timeout(attemptTimeout);
3765
+ });
3766
+
3767
+ const metricsHostId = 555;
3768
+ const metricsServiceId = 555;
3769
+ const metricsEnd = 'fakedata';
3770
+ const metricsStart = 'fakedata';
3771
+ describe('#getserviceperformancedata - errors', () => {
3772
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3773
+ try {
3774
+ a.getserviceperformancedata(metricsHostId, metricsServiceId, metricsStart, metricsEnd, (data, error) => {
3775
+ try {
3776
+ if (stub) {
3777
+ const displayE = 'Error 400 received on request';
3778
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3779
+ } else {
3780
+ runCommonAsserts(data, error);
3781
+ }
3782
+ saveMockData('Metrics', 'getserviceperformancedata', 'default', data);
3783
+ done();
3784
+ } catch (err) {
3785
+ log.error(`Test Failure: ${err}`);
3786
+ done(err);
3787
+ }
3788
+ });
3789
+ } catch (error) {
3790
+ log.error(`Adapter Exception: ${error}`);
3791
+ done(error);
3792
+ }
3793
+ }).timeout(attemptTimeout);
3794
+ });
3795
+
3796
+ const metricsStartDate = 'fakedata';
3797
+ describe('#downloadperformancedataascsvfile - errors', () => {
3798
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3799
+ try {
3800
+ a.downloadperformancedataascsvfile(metricsHostId, metricsServiceId, metricsStartDate, metricsEnd, (data, error) => {
3801
+ try {
3802
+ if (stub) {
3803
+ const displayE = 'Error 400 received on request';
3804
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3805
+ } else {
3806
+ runCommonAsserts(data, error);
3807
+ }
3808
+ saveMockData('Metrics', 'downloadperformancedataascsvfile', 'default', data);
3809
+ done();
3810
+ } catch (err) {
3811
+ log.error(`Test Failure: ${err}`);
3812
+ done(err);
3813
+ }
3814
+ });
3815
+ } catch (error) {
3816
+ log.error(`Adapter Exception: ${error}`);
3817
+ done(error);
3818
+ }
3819
+ }).timeout(attemptTimeout);
3820
+ });
3821
+
3822
+ describe('#getservicemetrics - errors', () => {
3823
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3824
+ try {
3825
+ a.getservicemetrics(metricsHostId, metricsServiceId, metricsStart, metricsEnd, (data, error) => {
3826
+ try {
3827
+ if (stub) {
3828
+ const displayE = 'Error 400 received on request';
3829
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3830
+ } else {
3831
+ runCommonAsserts(data, error);
3832
+ }
3833
+ saveMockData('Metrics', 'getservicemetrics', 'default', data);
3834
+ done();
3835
+ } catch (err) {
3836
+ log.error(`Test Failure: ${err}`);
3837
+ done(err);
3838
+ }
3839
+ });
3840
+ } catch (error) {
3841
+ log.error(`Adapter Exception: ${error}`);
3842
+ done(error);
3843
+ }
3844
+ }).timeout(attemptTimeout);
3845
+ });
3846
+
3847
+ describe('#getservicestatusdata1 - errors', () => {
3848
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3849
+ try {
3850
+ a.getservicestatusdata1(metricsHostId, metricsServiceId, metricsStart, metricsEnd, (data, error) => {
3851
+ try {
3852
+ if (stub) {
3853
+ const displayE = 'Error 400 received on request';
3854
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3855
+ } else {
3856
+ runCommonAsserts(data, error);
3857
+ }
3858
+ saveMockData('Metrics', 'getservicestatusdata1', 'default', data);
3859
+ done();
3860
+ } catch (err) {
3861
+ log.error(`Test Failure: ${err}`);
3862
+ done(err);
3863
+ }
3864
+ });
3865
+ } catch (error) {
3866
+ log.error(`Adapter Exception: ${error}`);
3867
+ done(error);
3868
+ }
3869
+ }).timeout(attemptTimeout);
3870
+ });
3871
+
3872
+ describe('#getservicestatusdata - errors', () => {
3873
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3874
+ try {
3875
+ a.getservicestatusdata(metricsHostId, metricsServiceId, metricsStart, metricsEnd, (data, error) => {
3876
+ try {
3877
+ if (stub) {
3878
+ const displayE = 'Error 400 received on request';
3879
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3880
+ } else {
3881
+ runCommonAsserts(data, error);
3882
+ }
3883
+ saveMockData('Metrics', 'getservicestatusdata', 'default', data);
3884
+ done();
3885
+ } catch (err) {
3886
+ log.error(`Test Failure: ${err}`);
3887
+ done(err);
3888
+ }
3889
+ });
3890
+ } catch (error) {
3891
+ log.error(`Adapter Exception: ${error}`);
3892
+ done(error);
3893
+ }
3894
+ }).timeout(attemptTimeout);
3895
+ });
3896
+
3897
+ const timelineHostId = 555;
3898
+ const timelineServiceId = 555;
3899
+ describe('#getservicetimeline - errors', () => {
3900
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3901
+ try {
3902
+ a.getservicetimeline(timelineHostId, timelineServiceId, null, null, null, null, (data, error) => {
3903
+ try {
3904
+ if (stub) {
3905
+ const displayE = 'Error 400 received on request';
3906
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3907
+ } else {
3908
+ runCommonAsserts(data, error);
3909
+ }
3910
+ saveMockData('Timeline', 'getservicetimeline', 'default', data);
3911
+ done();
3912
+ } catch (err) {
3913
+ log.error(`Test Failure: ${err}`);
3914
+ done(err);
3915
+ }
3916
+ });
3917
+ } catch (error) {
3918
+ log.error(`Adapter Exception: ${error}`);
3919
+ done(error);
3920
+ }
3921
+ }).timeout(attemptTimeout);
3922
+ });
3923
+
3924
+ describe('#gethosttimeline - errors', () => {
3925
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3926
+ try {
3927
+ a.gethosttimeline(timelineHostId, null, null, null, null, (data, error) => {
3928
+ try {
3929
+ if (stub) {
3930
+ const displayE = 'Error 400 received on request';
3931
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3932
+ } else {
3933
+ runCommonAsserts(data, error);
3934
+ }
3935
+ saveMockData('Timeline', 'gethosttimeline', 'default', data);
3936
+ done();
3937
+ } catch (err) {
3938
+ log.error(`Test Failure: ${err}`);
3939
+ done(err);
3940
+ }
3941
+ });
3942
+ } catch (error) {
3943
+ log.error(`Adapter Exception: ${error}`);
3944
+ done(error);
3945
+ }
3946
+ }).timeout(attemptTimeout);
3947
+ });
3948
+
3949
+ const platformUpdateaplatforminformationBodyParam = {
3950
+ platformName: 'string',
3951
+ isRemote: true,
3952
+ address: '10.0.0.1',
3953
+ centralServerAddress: '192.168.0.1',
3954
+ apiUsername: 'admin',
3955
+ apiCredentials: 'centreon',
3956
+ apiScheme: 'http',
3957
+ apiPort: 80,
3958
+ apiPath: 'centreon',
3959
+ peerValidation: true,
3960
+ proxy: {
3961
+ host: 'example.proxy.com',
3962
+ port: 80,
3963
+ user: 'admin',
3964
+ password: 'centreon'
3965
+ }
3966
+ };
3967
+ describe('#updateaplatforminformation - errors', () => {
3968
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3969
+ try {
3970
+ a.updateaplatforminformation(platformUpdateaplatforminformationBodyParam, (data, error) => {
3971
+ try {
3972
+ if (stub) {
3973
+ const displayE = 'Error 400 received on request';
3974
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
3975
+ } else {
3976
+ runCommonAsserts(data, error);
3977
+ }
3978
+ saveMockData('Platform', 'updateaplatforminformation', 'default', data);
3979
+ done();
3980
+ } catch (err) {
3981
+ log.error(`Test Failure: ${err}`);
3982
+ done(err);
3983
+ }
3984
+ });
3985
+ } catch (error) {
3986
+ log.error(`Adapter Exception: ${error}`);
3987
+ done(error);
3988
+ }
3989
+ }).timeout(attemptTimeout);
3990
+ });
3991
+
3992
+ describe('#getcentreonwebversions - errors', () => {
3993
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3994
+ try {
3995
+ a.getcentreonwebversions((data, error) => {
3996
+ try {
3997
+ if (stub) {
3998
+ const displayE = 'Error 400 received on request';
3999
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4000
+ } else {
4001
+ runCommonAsserts(data, error);
4002
+ }
4003
+ saveMockData('Platform', 'getcentreonwebversions', 'default', data);
4004
+ done();
4005
+ } catch (err) {
4006
+ log.error(`Test Failure: ${err}`);
4007
+ done(err);
4008
+ }
4009
+ });
4010
+ } catch (error) {
4011
+ log.error(`Adapter Exception: ${error}`);
4012
+ done(error);
4013
+ }
4014
+ }).timeout(attemptTimeout);
4015
+ });
4016
+
4017
+ const platformUpdateCentreonwebBodyParam = {
4018
+ components: [
4019
+ {
4020
+ name: 'centreon-web'
4021
+ }
4022
+ ]
4023
+ };
4024
+ describe('#updateCentreonweb - errors', () => {
4025
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4026
+ try {
4027
+ a.updateCentreonweb(platformUpdateCentreonwebBodyParam, (data, error) => {
4028
+ try {
4029
+ if (stub) {
4030
+ const displayE = 'Error 400 received on request';
4031
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4032
+ } else {
4033
+ runCommonAsserts(data, error);
4034
+ }
4035
+ saveMockData('Platform', 'updateCentreonweb', 'default', data);
4036
+ done();
4037
+ } catch (err) {
4038
+ log.error(`Test Failure: ${err}`);
4039
+ done(err);
4040
+ }
4041
+ });
4042
+ } catch (error) {
4043
+ log.error(`Adapter Exception: ${error}`);
4044
+ done(error);
4045
+ }
4046
+ }).timeout(attemptTimeout);
4047
+ });
4048
+
4049
+ describe('#listversionsofwebWidgetsandmodules - errors', () => {
4050
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4051
+ try {
4052
+ a.listversionsofwebWidgetsandmodules((data, error) => {
4053
+ try {
4054
+ if (stub) {
4055
+ const displayE = 'Error 400 received on request';
4056
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4057
+ } else {
4058
+ runCommonAsserts(data, error);
4059
+ }
4060
+ saveMockData('Platform', 'listversionsofwebWidgetsandmodules', 'default', data);
4061
+ done();
4062
+ } catch (err) {
4063
+ log.error(`Test Failure: ${err}`);
4064
+ done(err);
4065
+ }
4066
+ });
4067
+ } catch (error) {
4068
+ log.error(`Adapter Exception: ${error}`);
4069
+ done(error);
4070
+ }
4071
+ }).timeout(attemptTimeout);
4072
+ });
4073
+
4074
+ describe('#cancelanacknowledgementonahost - errors', () => {
4075
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4076
+ try {
4077
+ a.cancelanacknowledgementonahost(acknowledgementHostId, (data, error) => {
4078
+ try {
4079
+ if (stub) {
4080
+ const displayE = 'Error 400 received on request';
4081
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4082
+ } else {
4083
+ runCommonAsserts(data, error);
4084
+ }
4085
+ saveMockData('Acknowledgement', 'cancelanacknowledgementonahost', 'default', data);
4086
+ done();
4087
+ } catch (err) {
4088
+ log.error(`Test Failure: ${err}`);
4089
+ done(err);
4090
+ }
4091
+ });
4092
+ } catch (error) {
4093
+ log.error(`Adapter Exception: ${error}`);
4094
+ done(error);
4095
+ }
4096
+ }).timeout(attemptTimeout);
4097
+ });
4098
+
4099
+ describe('#cancelanacknowledgementonaservice - errors', () => {
4100
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4101
+ try {
4102
+ a.cancelanacknowledgementonaservice(acknowledgementHostId, acknowledgementServiceId, (data, error) => {
4103
+ try {
4104
+ if (stub) {
4105
+ const displayE = 'Error 400 received on request';
4106
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4107
+ } else {
4108
+ runCommonAsserts(data, error);
4109
+ }
4110
+ saveMockData('Acknowledgement', 'cancelanacknowledgementonaservice', 'default', data);
4111
+ done();
4112
+ } catch (err) {
4113
+ log.error(`Test Failure: ${err}`);
4114
+ done(err);
4115
+ }
4116
+ });
4117
+ } catch (error) {
4118
+ log.error(`Adapter Exception: ${error}`);
4119
+ done(error);
4120
+ }
4121
+ }).timeout(attemptTimeout);
4122
+ });
4123
+
4124
+ describe('#cancelanacknowledgementonametaservice - errors', () => {
4125
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4126
+ try {
4127
+ a.cancelanacknowledgementonametaservice(acknowledgementMetaId, (data, error) => {
4128
+ try {
4129
+ if (stub) {
4130
+ const displayE = 'Error 400 received on request';
4131
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4132
+ } else {
4133
+ runCommonAsserts(data, error);
4134
+ }
4135
+ saveMockData('Acknowledgement', 'cancelanacknowledgementonametaservice', 'default', data);
4136
+ done();
4137
+ } catch (err) {
4138
+ log.error(`Test Failure: ${err}`);
4139
+ done(err);
4140
+ }
4141
+ });
4142
+ } catch (error) {
4143
+ log.error(`Adapter Exception: ${error}`);
4144
+ done(error);
4145
+ }
4146
+ }).timeout(attemptTimeout);
4147
+ });
4148
+
4149
+ describe('#massivelydisacknowledgeresources - errors', () => {
4150
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4151
+ try {
4152
+ a.massivelydisacknowledgeresources((data, error) => {
4153
+ try {
4154
+ if (stub) {
4155
+ const displayE = 'Error 400 received on request';
4156
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4157
+ } else {
4158
+ runCommonAsserts(data, error);
4159
+ }
4160
+ saveMockData('Acknowledgement', 'massivelydisacknowledgeresources', 'default', data);
4161
+ done();
4162
+ } catch (err) {
4163
+ log.error(`Test Failure: ${err}`);
4164
+ done(err);
4165
+ }
4166
+ });
4167
+ } catch (error) {
4168
+ log.error(`Adapter Exception: ${error}`);
4169
+ done(error);
4170
+ }
4171
+ }).timeout(attemptTimeout);
4172
+ });
4173
+
4174
+ describe('#canceladowntime - errors', () => {
4175
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4176
+ try {
4177
+ a.canceladowntime(downtimeDowntimeId, (data, error) => {
4178
+ try {
4179
+ if (stub) {
4180
+ const displayE = 'Error 400 received on request';
4181
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4182
+ } else {
4183
+ runCommonAsserts(data, error);
4184
+ }
4185
+ saveMockData('Downtime', 'canceladowntime', 'default', data);
4186
+ done();
4187
+ } catch (err) {
4188
+ log.error(`Test Failure: ${err}`);
4189
+ done(err);
4190
+ }
4191
+ });
4192
+ } catch (error) {
4193
+ log.error(`Adapter Exception: ${error}`);
4194
+ done(error);
4195
+ }
4196
+ }).timeout(attemptTimeout);
4197
+ });
4198
+
4199
+ describe('#deletevaultconfiguration - errors', () => {
4200
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4201
+ try {
4202
+ a.deletevaultconfiguration(administrationVaultId, administrationVaultConfigurationId, (data, error) => {
4203
+ try {
4204
+ if (stub) {
4205
+ const displayE = 'Error 400 received on request';
4206
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4207
+ } else {
4208
+ runCommonAsserts(data, error);
4209
+ }
4210
+ saveMockData('Administration', 'deletevaultconfiguration', 'default', data);
4211
+ done();
4212
+ } catch (err) {
4213
+ log.error(`Test Failure: ${err}`);
4214
+ done(err);
4215
+ }
4216
+ });
4217
+ } catch (error) {
4218
+ log.error(`Adapter Exception: ${error}`);
4219
+ done(error);
4220
+ }
4221
+ }).timeout(attemptTimeout);
4222
+ });
4223
+
4224
+ const hostCategoryHostCategoryId = 555;
4225
+ describe('#deleteahostcategory - errors', () => {
4226
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4227
+ try {
4228
+ a.deleteahostcategory(hostCategoryHostCategoryId, (data, error) => {
4229
+ try {
4230
+ if (stub) {
4231
+ const displayE = 'Error 400 received on request';
4232
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4233
+ } else {
4234
+ runCommonAsserts(data, error);
4235
+ }
4236
+ saveMockData('HostCategory', 'deleteahostcategory', 'default', data);
4237
+ done();
4238
+ } catch (err) {
4239
+ log.error(`Test Failure: ${err}`);
4240
+ done(err);
4241
+ }
4242
+ });
4243
+ } catch (error) {
4244
+ log.error(`Adapter Exception: ${error}`);
4245
+ done(error);
4246
+ }
4247
+ }).timeout(attemptTimeout);
4248
+ });
4249
+
4250
+ const hostCategoryServiceCategoryId = 555;
4251
+ describe('#deleteaservicecategory - errors', () => {
4252
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4253
+ try {
4254
+ a.deleteaservicecategory(hostCategoryServiceCategoryId, (data, error) => {
4255
+ try {
4256
+ if (stub) {
4257
+ const displayE = 'Error 400 received on request';
4258
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4259
+ } else {
4260
+ runCommonAsserts(data, error);
4261
+ }
4262
+ saveMockData('HostCategory', 'deleteaservicecategory', 'default', data);
4263
+ done();
4264
+ } catch (err) {
4265
+ log.error(`Test Failure: ${err}`);
4266
+ done(err);
4267
+ }
4268
+ });
4269
+ } catch (error) {
4270
+ log.error(`Adapter Exception: ${error}`);
4271
+ done(error);
4272
+ }
4273
+ }).timeout(attemptTimeout);
4274
+ });
4275
+
4276
+ const hostGroupHostgroupId = 555;
4277
+ describe('#deleteahostgroup - errors', () => {
4278
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4279
+ try {
4280
+ a.deleteahostgroup(hostGroupHostgroupId, (data, error) => {
4281
+ try {
4282
+ if (stub) {
4283
+ const displayE = 'Error 400 received on request';
4284
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4285
+ } else {
4286
+ runCommonAsserts(data, error);
4287
+ }
4288
+ saveMockData('HostGroup', 'deleteahostgroup', 'default', data);
4289
+ done();
4290
+ } catch (err) {
4291
+ log.error(`Test Failure: ${err}`);
4292
+ done(err);
4293
+ }
4294
+ });
4295
+ } catch (error) {
4296
+ log.error(`Adapter Exception: ${error}`);
4297
+ done(error);
4298
+ }
4299
+ }).timeout(attemptTimeout);
4300
+ });
4301
+
4302
+ const hostSeverityHostSeverityId = 555;
4303
+ describe('#deleteahostseverity - errors', () => {
4304
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4305
+ try {
4306
+ a.deleteahostseverity(hostSeverityHostSeverityId, (data, error) => {
4307
+ try {
4308
+ if (stub) {
4309
+ const displayE = 'Error 400 received on request';
4310
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4311
+ } else {
4312
+ runCommonAsserts(data, error);
4313
+ }
4314
+ saveMockData('HostSeverity', 'deleteahostseverity', 'default', data);
4315
+ done();
4316
+ } catch (err) {
4317
+ log.error(`Test Failure: ${err}`);
4318
+ done(err);
4319
+ }
4320
+ });
4321
+ } catch (error) {
4322
+ log.error(`Adapter Exception: ${error}`);
4323
+ done(error);
4324
+ }
4325
+ }).timeout(attemptTimeout);
4326
+ });
4327
+
4328
+ const serviceGroupServicegroupId = 555;
4329
+ describe('#deleteahostgroup1 - errors', () => {
4330
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4331
+ try {
4332
+ a.deleteahostgroup1(serviceGroupServicegroupId, (data, error) => {
4333
+ try {
4334
+ if (stub) {
4335
+ const displayE = 'Error 400 received on request';
4336
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4337
+ } else {
4338
+ runCommonAsserts(data, error);
4339
+ }
4340
+ saveMockData('ServiceGroup', 'deleteahostgroup1', 'default', data);
4341
+ done();
4342
+ } catch (err) {
4343
+ log.error(`Test Failure: ${err}`);
4344
+ done(err);
4345
+ }
4346
+ });
4347
+ } catch (error) {
4348
+ log.error(`Adapter Exception: ${error}`);
4349
+ done(error);
4350
+ }
4351
+ }).timeout(attemptTimeout);
4352
+ });
4353
+
4354
+ describe('#deleteatimeperiod - errors', () => {
4355
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4356
+ try {
4357
+ a.deleteatimeperiod(timePeriodId, (data, error) => {
4358
+ try {
4359
+ if (stub) {
4360
+ const displayE = 'Error 400 received on request';
4361
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4362
+ } else {
4363
+ runCommonAsserts(data, error);
4364
+ }
4365
+ saveMockData('TimePeriod', 'deleteatimeperiod', 'default', data);
4366
+ done();
4367
+ } catch (err) {
4368
+ log.error(`Test Failure: ${err}`);
4369
+ done(err);
4370
+ }
4371
+ });
4372
+ } catch (error) {
4373
+ log.error(`Adapter Exception: ${error}`);
4374
+ done(error);
4375
+ }
4376
+ }).timeout(attemptTimeout);
4377
+ });
4378
+
4379
+ const topologyPollerId = 555;
4380
+ describe('#deleteaPlatform - errors', () => {
4381
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4382
+ try {
4383
+ a.deleteaPlatform(topologyPollerId, (data, error) => {
4384
+ try {
4385
+ if (stub) {
4386
+ const displayE = 'Error 400 received on request';
4387
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4388
+ } else {
4389
+ runCommonAsserts(data, error);
4390
+ }
4391
+ saveMockData('Topology', 'deleteaPlatform', 'default', data);
4392
+ done();
4393
+ } catch (err) {
4394
+ log.error(`Test Failure: ${err}`);
4395
+ done(err);
4396
+ }
4397
+ });
4398
+ } catch (error) {
4399
+ log.error(`Adapter Exception: ${error}`);
4400
+ done(error);
4401
+ }
4402
+ }).timeout(attemptTimeout);
4403
+ });
4404
+
4405
+ const serviceSeverityServiceSeverityId = 555;
4406
+ describe('#deleteaserviceseverity - errors', () => {
4407
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4408
+ try {
4409
+ a.deleteaserviceseverity(serviceSeverityServiceSeverityId, (data, error) => {
4410
+ try {
4411
+ if (stub) {
4412
+ const displayE = 'Error 400 received on request';
4413
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4414
+ } else {
4415
+ runCommonAsserts(data, error);
4416
+ }
4417
+ saveMockData('ServiceSeverity', 'deleteaserviceseverity', 'default', data);
4418
+ done();
4419
+ } catch (err) {
4420
+ log.error(`Test Failure: ${err}`);
4421
+ done(err);
4422
+ }
4423
+ });
4424
+ } catch (error) {
4425
+ log.error(`Adapter Exception: ${error}`);
4426
+ done(error);
4427
+ }
4428
+ }).timeout(attemptTimeout);
4429
+ });
4430
+
4431
+ describe('#deleteuserfilter - errors', () => {
4432
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4433
+ try {
4434
+ a.deleteuserfilter(userFiltersPageName, userFiltersFilterId, (data, error) => {
4435
+ try {
4436
+ if (stub) {
4437
+ const displayE = 'Error 400 received on request';
4438
+ runErrorAsserts(data, error, 'AD.500', 'Test-centreon-connectorRest-handleEndResponse', displayE);
4439
+ } else {
4440
+ runCommonAsserts(data, error);
4441
+ }
4442
+ saveMockData('UserFilters', 'deleteuserfilter', 'default', data);
4443
+ done();
4444
+ } catch (err) {
4445
+ log.error(`Test Failure: ${err}`);
4446
+ done(err);
4447
+ }
4448
+ });
4449
+ } catch (error) {
4450
+ log.error(`Adapter Exception: ${error}`);
4451
+ done(error);
4452
+ }
4453
+ }).timeout(attemptTimeout);
4454
+ });
4455
+ });
4456
+ });