@itentialopensource/adapter-adtran_mosaic_devicemanager 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 (69) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/CHANGELOG.md +9 -0
  5. package/CODE_OF_CONDUCT.md +48 -0
  6. package/CONTRIBUTING.md +158 -0
  7. package/ENHANCE.md +69 -0
  8. package/LICENSE +201 -0
  9. package/PROPERTIES.md +247 -0
  10. package/README.md +257 -0
  11. package/SUMMARY.md +9 -0
  12. package/TROUBLESHOOT.md +46 -0
  13. package/adapter.js +9118 -0
  14. package/adapterBase.js +1299 -0
  15. package/entities/.generic/action.json +109 -0
  16. package/entities/.generic/schema.json +23 -0
  17. package/entities/.system/action.json +50 -0
  18. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  19. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  20. package/entities/.system/schema.json +19 -0
  21. package/entities/.system/schemaTokenReq.json +53 -0
  22. package/entities/.system/schemaTokenResp.json +53 -0
  23. package/entities/DeviceAPI/action.json +1030 -0
  24. package/entities/DeviceAPI/mockdatafiles/configureDeviceLoggingLevel-default.json +3 -0
  25. package/entities/DeviceAPI/mockdatafiles/createDeviceAttributes-default.json +3 -0
  26. package/entities/DeviceAPI/mockdatafiles/createDevicePOST-default.json +4 -0
  27. package/entities/DeviceAPI/mockdatafiles/deviceTraceLevel-default.json +3 -0
  28. package/entities/DeviceAPI/mockdatafiles/modifyDeviceAttributes-default.json +3 -0
  29. package/entities/DeviceAPI/mockdatafiles/requestDeviceAttributeRefresh-default.json +4 -0
  30. package/entities/DeviceAPI/schema.json +68 -0
  31. package/entities/SubscriberAPI/action.json +901 -0
  32. package/entities/SubscriberAPI/mockdatafiles/deleteSubscriberAttributes-default.json +6 -0
  33. package/entities/SubscriberAPI/mockdatafiles/getUserRoles-default.json +4 -0
  34. package/entities/SubscriberAPI/mockdatafiles/modifySubscriber-default.json +4 -0
  35. package/entities/SubscriberAPI/mockdatafiles/statisticsForSpecificSubscriber-default.json +5 -0
  36. package/entities/SubscriberAPI/mockdatafiles/statisticsForSubscribers-default.json +3 -0
  37. package/entities/SubscriberAPI/schema.json +73 -0
  38. package/error.json +190 -0
  39. package/package.json +87 -0
  40. package/pronghorn.json +4935 -0
  41. package/propertiesDecorators.json +14 -0
  42. package/propertiesSchema.json +1204 -0
  43. package/refs?service=git-upload-pack +0 -0
  44. package/report/creationReport.json +599 -0
  45. package/report/openapi.json +7211 -0
  46. package/report/updateReport1651531040781.json +114 -0
  47. package/sampleProperties.json +106 -0
  48. package/test/integration/adapterTestBasicGet.js +85 -0
  49. package/test/integration/adapterTestConnectivity.js +93 -0
  50. package/test/integration/adapterTestIntegration.js +3582 -0
  51. package/test/unit/adapterBaseTestUnit.js +942 -0
  52. package/test/unit/adapterTestUnit.js +5053 -0
  53. package/utils/addAuth.js +94 -0
  54. package/utils/artifactize.js +146 -0
  55. package/utils/basicGet.js +50 -0
  56. package/utils/checkMigrate.js +63 -0
  57. package/utils/entitiesToDB.js +224 -0
  58. package/utils/findPath.js +74 -0
  59. package/utils/modify.js +154 -0
  60. package/utils/packModificationScript.js +35 -0
  61. package/utils/patches2bundledDeps.js +90 -0
  62. package/utils/pre-commit.sh +27 -0
  63. package/utils/removeHooks.js +20 -0
  64. package/utils/setup.js +33 -0
  65. package/utils/tbScript.js +169 -0
  66. package/utils/tbUtils.js +464 -0
  67. package/utils/testRunner.js +298 -0
  68. package/utils/troubleshootingAdapter.js +190 -0
  69. package/workflows/README.md +3 -0
@@ -0,0 +1,3582 @@
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
+
8
+ // include required items for testing & logging
9
+ const assert = require('assert');
10
+ const fs = require('fs');
11
+ const mocha = require('mocha');
12
+ const path = require('path');
13
+ const winston = require('winston');
14
+ const { expect } = require('chai');
15
+ const { use } = require('chai');
16
+ const td = require('testdouble');
17
+ const util = require('util');
18
+ const pronghorn = require('../../pronghorn.json');
19
+
20
+ pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
21
+ const anything = td.matchers.anything();
22
+
23
+ // stub and attemptTimeout are used throughout the code so set them here
24
+ let logLevel = 'none';
25
+ const stub = true;
26
+ const isRapidFail = false;
27
+ const isSaveMockData = false;
28
+ const attemptTimeout = 5000;
29
+
30
+ // these variables can be changed to run in integrated mode so easier to set them here
31
+ // always check these in with bogus data!!!
32
+ const host = 'replace.hostorip.here';
33
+ const username = 'username';
34
+ const password = 'password';
35
+ const protocol = 'http';
36
+ const port = 80;
37
+ const sslenable = false;
38
+ const sslinvalid = false;
39
+
40
+ // these are the adapter properties. You generally should not need to alter
41
+ // any of these after they are initially set up
42
+ global.pronghornProps = {
43
+ pathProps: {
44
+ encrypted: false
45
+ },
46
+ adapterProps: {
47
+ adapters: [{
48
+ id: 'Test-adtran_mosaic_devicemanager',
49
+ type: 'AdtranMosaicDeviceManager',
50
+ properties: {
51
+ host,
52
+ port,
53
+ base_path: '/',
54
+ version: '',
55
+ cache_location: 'none',
56
+ encode_pathvars: true,
57
+ save_metric: false,
58
+ stub,
59
+ protocol,
60
+ authentication: {
61
+ auth_method: 'basic user_password',
62
+ username,
63
+ password,
64
+ token: '',
65
+ invalid_token_error: 401,
66
+ token_timeout: -1,
67
+ token_cache: 'local',
68
+ auth_field: 'header.headers.X-AUTH-TOKEN',
69
+ auth_field_format: '{token}',
70
+ auth_logging: false,
71
+ client_id: '',
72
+ client_secret: '',
73
+ grant_type: ''
74
+ },
75
+ healthcheck: {
76
+ type: 'startup',
77
+ frequency: 60000,
78
+ query_object: {}
79
+ },
80
+ throttle: {
81
+ throttle_enabled: false,
82
+ number_pronghorns: 1,
83
+ sync_async: 'sync',
84
+ max_in_queue: 1000,
85
+ concurrent_max: 1,
86
+ expire_timeout: 0,
87
+ avg_runtime: 200,
88
+ priorities: [
89
+ {
90
+ value: 0,
91
+ percent: 100
92
+ }
93
+ ]
94
+ },
95
+ request: {
96
+ number_redirects: 0,
97
+ number_retries: 3,
98
+ limit_retry_error: [0],
99
+ failover_codes: [],
100
+ attempt_timeout: attemptTimeout,
101
+ global_request: {
102
+ payload: {},
103
+ uriOptions: {},
104
+ addlHeaders: {},
105
+ authData: {}
106
+ },
107
+ healthcheck_on_timeout: true,
108
+ return_raw: true,
109
+ archiving: false,
110
+ return_request: false
111
+ },
112
+ proxy: {
113
+ enabled: false,
114
+ host: '',
115
+ port: 1,
116
+ protocol: 'http',
117
+ username: '',
118
+ password: ''
119
+ },
120
+ ssl: {
121
+ ecdhCurve: '',
122
+ enabled: sslenable,
123
+ accept_invalid_cert: sslinvalid,
124
+ ca_file: '',
125
+ key_file: '',
126
+ cert_file: '',
127
+ secure_protocol: '',
128
+ ciphers: ''
129
+ },
130
+ mongo: {
131
+ host: '',
132
+ port: 0,
133
+ database: '',
134
+ username: '',
135
+ password: '',
136
+ replSet: '',
137
+ db_ssl: {
138
+ enabled: false,
139
+ accept_invalid_cert: false,
140
+ ca_file: '',
141
+ key_file: '',
142
+ cert_file: ''
143
+ }
144
+ }
145
+ }
146
+ }]
147
+ }
148
+ };
149
+
150
+ global.$HOME = `${__dirname}/../..`;
151
+
152
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
153
+ // this you may error on log.trace calls.
154
+ const myCustomLevels = {
155
+ levels: {
156
+ spam: 6,
157
+ trace: 5,
158
+ debug: 4,
159
+ info: 3,
160
+ warn: 2,
161
+ error: 1,
162
+ none: 0
163
+ }
164
+ };
165
+
166
+ // need to see if there is a log level passed in
167
+ process.argv.forEach((val) => {
168
+ // is there a log level defined to be passed in?
169
+ if (val.indexOf('--LOG') === 0) {
170
+ // get the desired log level
171
+ const inputVal = val.split('=')[1];
172
+
173
+ // validate the log level is supported, if so set it
174
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
175
+ logLevel = inputVal;
176
+ }
177
+ }
178
+ });
179
+
180
+ // need to set global logging
181
+ global.log = winston.createLogger({
182
+ level: logLevel,
183
+ levels: myCustomLevels.levels,
184
+ transports: [
185
+ new winston.transports.Console()
186
+ ]
187
+ });
188
+
189
+ /**
190
+ * Runs the common asserts for test
191
+ */
192
+ function runCommonAsserts(data, error) {
193
+ assert.equal(undefined, error);
194
+ assert.notEqual(undefined, data);
195
+ assert.notEqual(null, data);
196
+ assert.notEqual(undefined, data.response);
197
+ assert.notEqual(null, data.response);
198
+ }
199
+
200
+ /**
201
+ * Runs the error asserts for the test
202
+ */
203
+ function runErrorAsserts(data, error, code, origin, displayStr) {
204
+ assert.equal(null, data);
205
+ assert.notEqual(undefined, error);
206
+ assert.notEqual(null, error);
207
+ assert.notEqual(undefined, error.IAPerror);
208
+ assert.notEqual(null, error.IAPerror);
209
+ assert.notEqual(undefined, error.IAPerror.displayString);
210
+ assert.notEqual(null, error.IAPerror.displayString);
211
+ assert.equal(code, error.icode);
212
+ assert.equal(origin, error.IAPerror.origin);
213
+ assert.equal(displayStr, error.IAPerror.displayString);
214
+ }
215
+
216
+ /**
217
+ * @function saveMockData
218
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
219
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
220
+ * @param {string} entityName - Name of the entity saving mock data for
221
+ * @param {string} actionName - Name of the action saving mock data for
222
+ * @param {string} descriptor - Something to describe this test (used as a type)
223
+ * @param {string or object} responseData - The data to put in the mock file.
224
+ */
225
+ function saveMockData(entityName, actionName, descriptor, responseData) {
226
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
227
+ if (stub || !isSaveMockData) {
228
+ return false;
229
+ }
230
+
231
+ // must have a response in order to store the response
232
+ if (responseData && responseData.response) {
233
+ let data = responseData.response;
234
+
235
+ // if there was a raw response that one is better as it is untranslated
236
+ if (responseData.raw) {
237
+ data = responseData.raw;
238
+
239
+ try {
240
+ const temp = JSON.parse(data);
241
+ data = temp;
242
+ } catch (pex) {
243
+ // do not care if it did not parse as we will just use data
244
+ }
245
+ }
246
+
247
+ try {
248
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
249
+ const mockdatafolder = 'mockdatafiles';
250
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
251
+
252
+ if (!fs.existsSync(base + mockdatafolder)) {
253
+ fs.mkdirSync(base + mockdatafolder);
254
+ }
255
+
256
+ // write the data we retrieved
257
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
258
+ if (errWritingMock) throw errWritingMock;
259
+
260
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
261
+ fs.readFile(`${base}action.json`, (errRead, content) => {
262
+ if (errRead) throw errRead;
263
+
264
+ // parse the action file into JSON
265
+ const parsedJson = JSON.parse(content);
266
+
267
+ // The object update we'll write in.
268
+ const responseObj = {
269
+ type: descriptor,
270
+ key: '',
271
+ mockFile: filename
272
+ };
273
+
274
+ // get the object for method we're trying to change.
275
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
276
+
277
+ // if the method was not found - should never happen but...
278
+ if (!currentMethodAction) {
279
+ throw Error('Can\'t find an action for this method in the provided entity.');
280
+ }
281
+
282
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
283
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
284
+
285
+ // Add the action responseObj back into the array of response objects.
286
+ if (!actionResponseObj) {
287
+ // if there is a default response object, we want to get the key.
288
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
289
+
290
+ // save the default key into the new response object
291
+ if (defaultResponseObj) {
292
+ responseObj.key = defaultResponseObj.key;
293
+ }
294
+
295
+ // save the new response object
296
+ currentMethodAction.responseObjects = [responseObj];
297
+ } else {
298
+ // update the location of the mock data file
299
+ actionResponseObj.mockFile = responseObj.mockFile;
300
+ }
301
+
302
+ // Save results
303
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
304
+ if (err) throw err;
305
+ });
306
+ });
307
+ });
308
+ } catch (e) {
309
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
310
+ return false;
311
+ }
312
+ }
313
+
314
+ // no response to save
315
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
316
+ return false;
317
+ }
318
+
319
+ // require the adapter that we are going to be using
320
+ const AdtranMosaicDeviceManager = require('../../adapter');
321
+
322
+ // begin the testing - these should be pretty well defined between the describe and the it!
323
+ describe('[integration] AdtranMosaicDeviceManager Adapter Test', () => {
324
+ describe('AdtranMosaicDeviceManager Class Tests', () => {
325
+ const a = new AdtranMosaicDeviceManager(
326
+ pronghornProps.adapterProps.adapters[0].id,
327
+ pronghornProps.adapterProps.adapters[0].properties
328
+ );
329
+
330
+ if (isRapidFail) {
331
+ const state = {};
332
+ state.passed = true;
333
+
334
+ mocha.afterEach(function x() {
335
+ state.passed = state.passed
336
+ && (this.currentTest.state === 'passed');
337
+ });
338
+ mocha.beforeEach(function x() {
339
+ if (!state.passed) {
340
+ return this.currentTest.skip();
341
+ }
342
+ return true;
343
+ });
344
+ }
345
+
346
+ describe('#class instance created', () => {
347
+ it('should be a class with properties', (done) => {
348
+ try {
349
+ assert.notEqual(null, a);
350
+ assert.notEqual(undefined, a);
351
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
352
+ assert.equal(checkId, a.id);
353
+ assert.notEqual(null, a.allProps);
354
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
355
+ assert.equal(check, a.healthcheckType);
356
+ done();
357
+ } catch (error) {
358
+ log.error(`Test Failure: ${error}`);
359
+ done(error);
360
+ }
361
+ }).timeout(attemptTimeout);
362
+ });
363
+
364
+ describe('#connect', () => {
365
+ it('should get connected - no healthcheck', (done) => {
366
+ try {
367
+ a.healthcheckType = 'none';
368
+ a.connect();
369
+
370
+ try {
371
+ assert.equal(true, a.alive);
372
+ done();
373
+ } catch (error) {
374
+ log.error(`Test Failure: ${error}`);
375
+ done(error);
376
+ }
377
+ } catch (error) {
378
+ log.error(`Adapter Exception: ${error}`);
379
+ done(error);
380
+ }
381
+ });
382
+ it('should get connected - startup healthcheck', (done) => {
383
+ try {
384
+ a.healthcheckType = 'startup';
385
+ a.connect();
386
+
387
+ try {
388
+ assert.equal(true, a.alive);
389
+ done();
390
+ } catch (error) {
391
+ log.error(`Test Failure: ${error}`);
392
+ done(error);
393
+ }
394
+ } catch (error) {
395
+ log.error(`Adapter Exception: ${error}`);
396
+ done(error);
397
+ }
398
+ });
399
+ });
400
+
401
+ describe('#healthCheck', () => {
402
+ it('should be healthy', (done) => {
403
+ try {
404
+ a.healthCheck(null, (data) => {
405
+ try {
406
+ assert.equal(true, a.healthy);
407
+ saveMockData('system', 'healthcheck', 'default', data);
408
+ done();
409
+ } catch (err) {
410
+ log.error(`Test Failure: ${err}`);
411
+ done(err);
412
+ }
413
+ });
414
+ } catch (error) {
415
+ log.error(`Adapter Exception: ${error}`);
416
+ done(error);
417
+ }
418
+ }).timeout(attemptTimeout);
419
+ });
420
+
421
+ /*
422
+ -----------------------------------------------------------------------
423
+ -----------------------------------------------------------------------
424
+ *** All code above this comment will be replaced during a migration ***
425
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
426
+ -----------------------------------------------------------------------
427
+ -----------------------------------------------------------------------
428
+ */
429
+ let skipCount = 0;
430
+
431
+ let deviceAPIDeviceId = 'fakedata';
432
+ const deviceAPICreateDevicePOSTBodyParam = {
433
+ sn: 'string',
434
+ oui: 'string'
435
+ };
436
+ describe('#createDevicePOST - errors', () => {
437
+ it('should work if integrated or standalone with mockdata', (done) => {
438
+ if (pronghorn.methodsByName.createDevicePOST.task) {
439
+ try {
440
+ a.createDevicePOST(deviceAPICreateDevicePOSTBodyParam, (data, error) => {
441
+ try {
442
+ if (stub) {
443
+ runCommonAsserts(data, error);
444
+ assert.equal('string', data.response.deviceId);
445
+ assert.equal('string', data.response.disposition);
446
+ } else {
447
+ runCommonAsserts(data, error);
448
+ }
449
+ deviceAPIDeviceId = data.response.deviceId;
450
+ saveMockData('DeviceAPI', 'createDevicePOST', 'default', data);
451
+ done();
452
+ } catch (err) {
453
+ log.error(`Test Failure: ${err}`);
454
+ done(err);
455
+ }
456
+ });
457
+ } catch (error) {
458
+ log.error(`Adapter Exception: ${error}`);
459
+ done(error);
460
+ }
461
+ } else {
462
+ log.error('createDevicePOST task is false, skipping test');
463
+ skipCount += 1;
464
+ done();
465
+ }// end if task
466
+ }).timeout(attemptTimeout);
467
+ });
468
+
469
+ const deviceAPIDeviceTypeId = 'fakedata';
470
+ const deviceAPIModifyDeviceTypeBodyParam = {
471
+ friendlyName: 'string',
472
+ friendlyManufacturerName: 'string',
473
+ hardwareVersion: 'string',
474
+ productClass: 'string',
475
+ modelName: 'string',
476
+ imageURL: 'string',
477
+ wanInterfaceType: 'string'
478
+ };
479
+ describe('#modifyDeviceType - errors', () => {
480
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
481
+ if (pronghorn.methodsByName.modifyDeviceType.task) {
482
+ try {
483
+ a.modifyDeviceType(deviceAPIDeviceTypeId, deviceAPIModifyDeviceTypeBodyParam, (data, error) => {
484
+ try {
485
+ if (stub) {
486
+ const displayE = 'Error 400 received on request';
487
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
488
+ } else {
489
+ runCommonAsserts(data, error);
490
+ }
491
+ saveMockData('DeviceAPI', 'modifyDeviceType', 'default', data);
492
+ done();
493
+ } catch (err) {
494
+ log.error(`Test Failure: ${err}`);
495
+ done(err);
496
+ }
497
+ });
498
+ } catch (error) {
499
+ log.error(`Adapter Exception: ${error}`);
500
+ done(error);
501
+ }
502
+ } else {
503
+ log.error('modifyDeviceType task is false, skipping test');
504
+ skipCount += 1;
505
+ done();
506
+ }// end if task
507
+ }).timeout(attemptTimeout);
508
+ });
509
+
510
+ const deviceAPIFirmwareId = 555;
511
+ const deviceAPIModifyFirmwareDescriptionBodyParam = {
512
+ deviceTypeId: 2,
513
+ softwareVersion: 'string',
514
+ binaryURL: 'string',
515
+ releaseDate: 'string'
516
+ };
517
+ describe('#modifyFirmwareDescription - errors', () => {
518
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
519
+ if (pronghorn.methodsByName.modifyFirmwareDescription.task) {
520
+ try {
521
+ a.modifyFirmwareDescription(deviceAPIDeviceTypeId, deviceAPIFirmwareId, deviceAPIModifyFirmwareDescriptionBodyParam, (data, error) => {
522
+ try {
523
+ if (stub) {
524
+ const displayE = 'Error 400 received on request';
525
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
526
+ } else {
527
+ runCommonAsserts(data, error);
528
+ }
529
+ saveMockData('DeviceAPI', 'modifyFirmwareDescription', 'default', data);
530
+ done();
531
+ } catch (err) {
532
+ log.error(`Test Failure: ${err}`);
533
+ done(err);
534
+ }
535
+ });
536
+ } catch (error) {
537
+ log.error(`Adapter Exception: ${error}`);
538
+ done(error);
539
+ }
540
+ } else {
541
+ log.error('modifyFirmwareDescription task is false, skipping test');
542
+ skipCount += 1;
543
+ done();
544
+ }// end if task
545
+ }).timeout(attemptTimeout);
546
+ });
547
+
548
+ const deviceAPIModifyFirmwareLabelsBodyParam = [
549
+ 'string'
550
+ ];
551
+ describe('#modifyFirmwareLabels - errors', () => {
552
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
553
+ if (pronghorn.methodsByName.modifyFirmwareLabels.task) {
554
+ try {
555
+ a.modifyFirmwareLabels(deviceAPIDeviceTypeId, deviceAPIFirmwareId, deviceAPIModifyFirmwareLabelsBodyParam, (data, error) => {
556
+ try {
557
+ if (stub) {
558
+ const displayE = 'Error 400 received on request';
559
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
560
+ } else {
561
+ runCommonAsserts(data, error);
562
+ }
563
+ saveMockData('DeviceAPI', 'modifyFirmwareLabels', 'default', data);
564
+ done();
565
+ } catch (err) {
566
+ log.error(`Test Failure: ${err}`);
567
+ done(err);
568
+ }
569
+ });
570
+ } catch (error) {
571
+ log.error(`Adapter Exception: ${error}`);
572
+ done(error);
573
+ }
574
+ } else {
575
+ log.error('modifyFirmwareLabels task is false, skipping test');
576
+ skipCount += 1;
577
+ done();
578
+ }// end if task
579
+ }).timeout(attemptTimeout);
580
+ });
581
+
582
+ const deviceAPIId = 555;
583
+ const deviceAPIScriptRunId = 555;
584
+ const deviceAPIModifyScriptIDAndParametersForQueuedActionBodyParam = {
585
+ params: [
586
+ {
587
+ name: 'string',
588
+ value: 'string'
589
+ }
590
+ ]
591
+ };
592
+ describe('#modifyScriptIDAndParametersForQueuedAction - errors', () => {
593
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
594
+ if (pronghorn.methodsByName.modifyScriptIDAndParametersForQueuedAction.task) {
595
+ try {
596
+ a.modifyScriptIDAndParametersForQueuedAction(deviceAPIId, deviceAPIScriptRunId, deviceAPIModifyScriptIDAndParametersForQueuedActionBodyParam, (data, error) => {
597
+ try {
598
+ if (stub) {
599
+ const displayE = 'Error 400 received on request';
600
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
601
+ } else {
602
+ runCommonAsserts(data, error);
603
+ }
604
+ saveMockData('DeviceAPI', 'modifyScriptIDAndParametersForQueuedAction', '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
+ } else {
616
+ log.error('modifyScriptIDAndParametersForQueuedAction task is false, skipping test');
617
+ skipCount += 1;
618
+ done();
619
+ }// end if task
620
+ }).timeout(attemptTimeout);
621
+ });
622
+
623
+ const deviceAPIModifyDeviceAttributesBodyParam = {};
624
+ describe('#modifyDeviceAttributes - errors', () => {
625
+ it('should work if integrated or standalone with mockdata', (done) => {
626
+ if (pronghorn.methodsByName.modifyDeviceAttributes.task) {
627
+ try {
628
+ a.modifyDeviceAttributes(deviceAPIId, null, deviceAPIModifyDeviceAttributesBodyParam, (data, error) => {
629
+ try {
630
+ if (stub) {
631
+ runCommonAsserts(data, error);
632
+ assert.equal(2, data.response.scriptRunId);
633
+ } else {
634
+ runCommonAsserts(data, error);
635
+ }
636
+ saveMockData('DeviceAPI', 'modifyDeviceAttributes', 'default', data);
637
+ done();
638
+ } catch (err) {
639
+ log.error(`Test Failure: ${err}`);
640
+ done(err);
641
+ }
642
+ });
643
+ } catch (error) {
644
+ log.error(`Adapter Exception: ${error}`);
645
+ done(error);
646
+ }
647
+ } else {
648
+ log.error('modifyDeviceAttributes task is false, skipping test');
649
+ skipCount += 1;
650
+ done();
651
+ }// end if task
652
+ }).timeout(attemptTimeout);
653
+ });
654
+
655
+ const deviceAPIModifyDeviceLabelsBodyParam = [
656
+ 'string'
657
+ ];
658
+ describe('#modifyDeviceLabels - errors', () => {
659
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
660
+ if (pronghorn.methodsByName.modifyDeviceLabels.task) {
661
+ try {
662
+ a.modifyDeviceLabels(deviceAPIId, deviceAPIModifyDeviceLabelsBodyParam, (data, error) => {
663
+ try {
664
+ if (stub) {
665
+ const displayE = 'Error 400 received on request';
666
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
667
+ } else {
668
+ runCommonAsserts(data, error);
669
+ }
670
+ saveMockData('DeviceAPI', 'modifyDeviceLabels', 'default', data);
671
+ done();
672
+ } catch (err) {
673
+ log.error(`Test Failure: ${err}`);
674
+ done(err);
675
+ }
676
+ });
677
+ } catch (error) {
678
+ log.error(`Adapter Exception: ${error}`);
679
+ done(error);
680
+ }
681
+ } else {
682
+ log.error('modifyDeviceLabels task is false, skipping test');
683
+ skipCount += 1;
684
+ done();
685
+ }// end if task
686
+ }).timeout(attemptTimeout);
687
+ });
688
+
689
+ describe('#lockDevice - errors', () => {
690
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
691
+ if (pronghorn.methodsByName.lockDevice.task) {
692
+ try {
693
+ a.lockDevice(deviceAPIId, (data, error) => {
694
+ try {
695
+ if (stub) {
696
+ const displayE = 'Error 400 received on request';
697
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
698
+ } else {
699
+ runCommonAsserts(data, error);
700
+ }
701
+ saveMockData('DeviceAPI', 'lockDevice', 'default', data);
702
+ done();
703
+ } catch (err) {
704
+ log.error(`Test Failure: ${err}`);
705
+ done(err);
706
+ }
707
+ });
708
+ } catch (error) {
709
+ log.error(`Adapter Exception: ${error}`);
710
+ done(error);
711
+ }
712
+ } else {
713
+ log.error('lockDevice task is false, skipping test');
714
+ skipCount += 1;
715
+ done();
716
+ }// end if task
717
+ }).timeout(attemptTimeout);
718
+ });
719
+
720
+ const deviceAPIConfigureDeviceLoggingLevelBodyParam = {
721
+ loggingLevel: 'TRACE'
722
+ };
723
+ describe('#configureDeviceLoggingLevel - errors', () => {
724
+ it('should work if integrated or standalone with mockdata', (done) => {
725
+ if (pronghorn.methodsByName.configureDeviceLoggingLevel.task) {
726
+ try {
727
+ a.configureDeviceLoggingLevel(deviceAPIId, deviceAPIConfigureDeviceLoggingLevelBodyParam, (data, error) => {
728
+ try {
729
+ if (stub) {
730
+ runCommonAsserts(data, error);
731
+ assert.equal('INFO', data.response.loggingLevel);
732
+ } else {
733
+ runCommonAsserts(data, error);
734
+ }
735
+ saveMockData('DeviceAPI', 'configureDeviceLoggingLevel', 'default', data);
736
+ done();
737
+ } catch (err) {
738
+ log.error(`Test Failure: ${err}`);
739
+ done(err);
740
+ }
741
+ });
742
+ } catch (error) {
743
+ log.error(`Adapter Exception: ${error}`);
744
+ done(error);
745
+ }
746
+ } else {
747
+ log.error('configureDeviceLoggingLevel task is false, skipping test');
748
+ skipCount += 1;
749
+ done();
750
+ }// end if task
751
+ }).timeout(attemptTimeout);
752
+ });
753
+
754
+ describe('#getDeviceTemplate - errors', () => {
755
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
756
+ if (pronghorn.methodsByName.getDeviceTemplate.task) {
757
+ try {
758
+ a.getDeviceTemplate((data, error) => {
759
+ try {
760
+ if (stub) {
761
+ const displayE = 'Error 400 received on request';
762
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
763
+ } else {
764
+ runCommonAsserts(data, error);
765
+ }
766
+ saveMockData('DeviceAPI', 'getDeviceTemplate', 'default', data);
767
+ done();
768
+ } catch (err) {
769
+ log.error(`Test Failure: ${err}`);
770
+ done(err);
771
+ }
772
+ });
773
+ } catch (error) {
774
+ log.error(`Adapter Exception: ${error}`);
775
+ done(error);
776
+ }
777
+ } else {
778
+ log.error('getDeviceTemplate task is false, skipping test');
779
+ skipCount += 1;
780
+ done();
781
+ }// end if task
782
+ }).timeout(attemptTimeout);
783
+ });
784
+
785
+ const deviceAPIFirst = 555;
786
+ const deviceAPICount = 555;
787
+ const deviceAPIQ = 'fakedata';
788
+ describe('#accessDevicesOnActivationServer - errors', () => {
789
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
790
+ if (pronghorn.methodsByName.accessDevicesOnActivationServer.task) {
791
+ try {
792
+ a.accessDevicesOnActivationServer(deviceAPIFirst, deviceAPICount, deviceAPIQ, (data, error) => {
793
+ try {
794
+ if (stub) {
795
+ const displayE = 'Error 400 received on request';
796
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
797
+ } else {
798
+ runCommonAsserts(data, error);
799
+ }
800
+ saveMockData('DeviceAPI', 'accessDevicesOnActivationServer', 'default', data);
801
+ done();
802
+ } catch (err) {
803
+ log.error(`Test Failure: ${err}`);
804
+ done(err);
805
+ }
806
+ });
807
+ } catch (error) {
808
+ log.error(`Adapter Exception: ${error}`);
809
+ done(error);
810
+ }
811
+ } else {
812
+ log.error('accessDevicesOnActivationServer task is false, skipping test');
813
+ skipCount += 1;
814
+ done();
815
+ }// end if task
816
+ }).timeout(attemptTimeout);
817
+ });
818
+
819
+ const deviceAPIUpdateListOfDevicesConnectedToACSBodyParam = {
820
+ manufacturer: 'string',
821
+ oui: 'string',
822
+ productClass: 'string',
823
+ serial: 'string',
824
+ provisioningCode: 'string',
825
+ rootName: 'string'
826
+ };
827
+ describe('#updateListOfDevicesConnectedToACS - errors', () => {
828
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
829
+ if (pronghorn.methodsByName.updateListOfDevicesConnectedToACS.task) {
830
+ try {
831
+ a.updateListOfDevicesConnectedToACS(deviceAPIUpdateListOfDevicesConnectedToACSBodyParam, (data, error) => {
832
+ try {
833
+ if (stub) {
834
+ const displayE = 'Error 400 received on request';
835
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
836
+ } else {
837
+ runCommonAsserts(data, error);
838
+ }
839
+ saveMockData('DeviceAPI', 'updateListOfDevicesConnectedToACS', 'default', data);
840
+ done();
841
+ } catch (err) {
842
+ log.error(`Test Failure: ${err}`);
843
+ done(err);
844
+ }
845
+ });
846
+ } catch (error) {
847
+ log.error(`Adapter Exception: ${error}`);
848
+ done(error);
849
+ }
850
+ } else {
851
+ log.error('updateListOfDevicesConnectedToACS task is false, skipping test');
852
+ skipCount += 1;
853
+ done();
854
+ }// end if task
855
+ }).timeout(attemptTimeout);
856
+ });
857
+
858
+ describe('#countOfDevicesInACSByDeviceType - errors', () => {
859
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
860
+ if (pronghorn.methodsByName.countOfDevicesInACSByDeviceType.task) {
861
+ try {
862
+ a.countOfDevicesInACSByDeviceType((data, error) => {
863
+ try {
864
+ if (stub) {
865
+ const displayE = 'Error 400 received on request';
866
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
867
+ } else {
868
+ runCommonAsserts(data, error);
869
+ }
870
+ saveMockData('DeviceAPI', 'countOfDevicesInACSByDeviceType', 'default', data);
871
+ done();
872
+ } catch (err) {
873
+ log.error(`Test Failure: ${err}`);
874
+ done(err);
875
+ }
876
+ });
877
+ } catch (error) {
878
+ log.error(`Adapter Exception: ${error}`);
879
+ done(error);
880
+ }
881
+ } else {
882
+ log.error('countOfDevicesInACSByDeviceType task is false, skipping test');
883
+ skipCount += 1;
884
+ done();
885
+ }// end if task
886
+ }).timeout(attemptTimeout);
887
+ });
888
+
889
+ const deviceAPICreateDeviceTypeBodyParam = {
890
+ friendlyName: 'string',
891
+ friendlyManufacturerName: 'string',
892
+ hardwareVersion: 'string',
893
+ productClass: 'string',
894
+ modelName: 'string',
895
+ imageURL: 'string',
896
+ wanInterfaceType: 'string'
897
+ };
898
+ describe('#createDeviceType - errors', () => {
899
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
900
+ if (pronghorn.methodsByName.createDeviceType.task) {
901
+ try {
902
+ a.createDeviceType(deviceAPICreateDeviceTypeBodyParam, (data, error) => {
903
+ try {
904
+ if (stub) {
905
+ const displayE = 'Error 400 received on request';
906
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
907
+ } else {
908
+ runCommonAsserts(data, error);
909
+ }
910
+ saveMockData('DeviceAPI', 'createDeviceType', 'default', data);
911
+ done();
912
+ } catch (err) {
913
+ log.error(`Test Failure: ${err}`);
914
+ done(err);
915
+ }
916
+ });
917
+ } catch (error) {
918
+ log.error(`Adapter Exception: ${error}`);
919
+ done(error);
920
+ }
921
+ } else {
922
+ log.error('createDeviceType task is false, skipping test');
923
+ skipCount += 1;
924
+ done();
925
+ }// end if task
926
+ }).timeout(attemptTimeout);
927
+ });
928
+
929
+ describe('#listOfDeviceTypesDefindedInACS - errors', () => {
930
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
931
+ if (pronghorn.methodsByName.listOfDeviceTypesDefindedInACS.task) {
932
+ try {
933
+ a.listOfDeviceTypesDefindedInACS(deviceAPIFirst, deviceAPICount, (data, error) => {
934
+ try {
935
+ if (stub) {
936
+ const displayE = 'Error 400 received on request';
937
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
938
+ } else {
939
+ runCommonAsserts(data, error);
940
+ }
941
+ saveMockData('DeviceAPI', 'listOfDeviceTypesDefindedInACS', 'default', data);
942
+ done();
943
+ } catch (err) {
944
+ log.error(`Test Failure: ${err}`);
945
+ done(err);
946
+ }
947
+ });
948
+ } catch (error) {
949
+ log.error(`Adapter Exception: ${error}`);
950
+ done(error);
951
+ }
952
+ } else {
953
+ log.error('listOfDeviceTypesDefindedInACS task is false, skipping test');
954
+ skipCount += 1;
955
+ done();
956
+ }// end if task
957
+ }).timeout(attemptTimeout);
958
+ });
959
+
960
+ describe('#listOfDeviceTypesCheckingInToACS - errors', () => {
961
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
962
+ if (pronghorn.methodsByName.listOfDeviceTypesCheckingInToACS.task) {
963
+ try {
964
+ a.listOfDeviceTypesCheckingInToACS(deviceAPIDeviceTypeId, (data, error) => {
965
+ try {
966
+ if (stub) {
967
+ const displayE = 'Error 400 received on request';
968
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
969
+ } else {
970
+ runCommonAsserts(data, error);
971
+ }
972
+ saveMockData('DeviceAPI', 'listOfDeviceTypesCheckingInToACS', 'default', data);
973
+ done();
974
+ } catch (err) {
975
+ log.error(`Test Failure: ${err}`);
976
+ done(err);
977
+ }
978
+ });
979
+ } catch (error) {
980
+ log.error(`Adapter Exception: ${error}`);
981
+ done(error);
982
+ }
983
+ } else {
984
+ log.error('listOfDeviceTypesCheckingInToACS task is false, skipping test');
985
+ skipCount += 1;
986
+ done();
987
+ }// end if task
988
+ }).timeout(attemptTimeout);
989
+ });
990
+
991
+ const deviceAPIAddFirmwareResourceByDeviceTypeBodyParam = {
992
+ softwareVersion: 'string',
993
+ binaryURL: 'string',
994
+ releaseDate: 'string'
995
+ };
996
+ describe('#addFirmwareResourceByDeviceType - errors', () => {
997
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
998
+ if (pronghorn.methodsByName.addFirmwareResourceByDeviceType.task) {
999
+ try {
1000
+ a.addFirmwareResourceByDeviceType(deviceAPIDeviceTypeId, deviceAPIAddFirmwareResourceByDeviceTypeBodyParam, (data, error) => {
1001
+ try {
1002
+ if (stub) {
1003
+ const displayE = 'Error 400 received on request';
1004
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1005
+ } else {
1006
+ runCommonAsserts(data, error);
1007
+ }
1008
+ saveMockData('DeviceAPI', 'addFirmwareResourceByDeviceType', 'default', data);
1009
+ done();
1010
+ } catch (err) {
1011
+ log.error(`Test Failure: ${err}`);
1012
+ done(err);
1013
+ }
1014
+ });
1015
+ } catch (error) {
1016
+ log.error(`Adapter Exception: ${error}`);
1017
+ done(error);
1018
+ }
1019
+ } else {
1020
+ log.error('addFirmwareResourceByDeviceType task is false, skipping test');
1021
+ skipCount += 1;
1022
+ done();
1023
+ }// end if task
1024
+ }).timeout(attemptTimeout);
1025
+ });
1026
+
1027
+ const deviceAPIDeviceType = 555;
1028
+ describe('#firmwareResourceListByDeviceType - errors', () => {
1029
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1030
+ if (pronghorn.methodsByName.firmwareResourceListByDeviceType.task) {
1031
+ try {
1032
+ a.firmwareResourceListByDeviceType(deviceAPIDeviceTypeId, deviceAPIFirst, deviceAPICount, deviceAPIDeviceType, (data, error) => {
1033
+ try {
1034
+ if (stub) {
1035
+ const displayE = 'Error 400 received on request';
1036
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1037
+ } else {
1038
+ runCommonAsserts(data, error);
1039
+ }
1040
+ saveMockData('DeviceAPI', 'firmwareResourceListByDeviceType', 'default', data);
1041
+ done();
1042
+ } catch (err) {
1043
+ log.error(`Test Failure: ${err}`);
1044
+ done(err);
1045
+ }
1046
+ });
1047
+ } catch (error) {
1048
+ log.error(`Adapter Exception: ${error}`);
1049
+ done(error);
1050
+ }
1051
+ } else {
1052
+ log.error('firmwareResourceListByDeviceType task is false, skipping test');
1053
+ skipCount += 1;
1054
+ done();
1055
+ }// end if task
1056
+ }).timeout(attemptTimeout);
1057
+ });
1058
+
1059
+ describe('#firmwareDescription - errors', () => {
1060
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1061
+ if (pronghorn.methodsByName.firmwareDescription.task) {
1062
+ try {
1063
+ a.firmwareDescription(deviceAPIDeviceTypeId, deviceAPIFirmwareId, (data, error) => {
1064
+ try {
1065
+ if (stub) {
1066
+ const displayE = 'Error 400 received on request';
1067
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1068
+ } else {
1069
+ runCommonAsserts(data, error);
1070
+ }
1071
+ saveMockData('DeviceAPI', 'firmwareDescription', 'default', data);
1072
+ done();
1073
+ } catch (err) {
1074
+ log.error(`Test Failure: ${err}`);
1075
+ done(err);
1076
+ }
1077
+ });
1078
+ } catch (error) {
1079
+ log.error(`Adapter Exception: ${error}`);
1080
+ done(error);
1081
+ }
1082
+ } else {
1083
+ log.error('firmwareDescription task is false, skipping test');
1084
+ skipCount += 1;
1085
+ done();
1086
+ }// end if task
1087
+ }).timeout(attemptTimeout);
1088
+ });
1089
+
1090
+ describe('#firmwareResourceLabelsByIDForDeviceType - errors', () => {
1091
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1092
+ if (pronghorn.methodsByName.firmwareResourceLabelsByIDForDeviceType.task) {
1093
+ try {
1094
+ a.firmwareResourceLabelsByIDForDeviceType(deviceAPIDeviceTypeId, deviceAPIFirmwareId, (data, error) => {
1095
+ try {
1096
+ if (stub) {
1097
+ const displayE = 'Error 400 received on request';
1098
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1099
+ } else {
1100
+ runCommonAsserts(data, error);
1101
+ }
1102
+ saveMockData('DeviceAPI', 'firmwareResourceLabelsByIDForDeviceType', 'default', data);
1103
+ done();
1104
+ } catch (err) {
1105
+ log.error(`Test Failure: ${err}`);
1106
+ done(err);
1107
+ }
1108
+ });
1109
+ } catch (error) {
1110
+ log.error(`Adapter Exception: ${error}`);
1111
+ done(error);
1112
+ }
1113
+ } else {
1114
+ log.error('firmwareResourceLabelsByIDForDeviceType task is false, skipping test');
1115
+ skipCount += 1;
1116
+ done();
1117
+ }// end if task
1118
+ }).timeout(attemptTimeout);
1119
+ });
1120
+
1121
+ describe('#deviceDetailsGET - errors', () => {
1122
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1123
+ if (pronghorn.methodsByName.deviceDetailsGET.task) {
1124
+ try {
1125
+ a.deviceDetailsGET(deviceAPIId, (data, error) => {
1126
+ try {
1127
+ if (stub) {
1128
+ const displayE = 'Error 400 received on request';
1129
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1130
+ } else {
1131
+ runCommonAsserts(data, error);
1132
+ }
1133
+ saveMockData('DeviceAPI', 'deviceDetailsGET', 'default', data);
1134
+ done();
1135
+ } catch (err) {
1136
+ log.error(`Test Failure: ${err}`);
1137
+ done(err);
1138
+ }
1139
+ });
1140
+ } catch (error) {
1141
+ log.error(`Adapter Exception: ${error}`);
1142
+ done(error);
1143
+ }
1144
+ } else {
1145
+ log.error('deviceDetailsGET task is false, skipping test');
1146
+ skipCount += 1;
1147
+ done();
1148
+ }// end if task
1149
+ }).timeout(attemptTimeout);
1150
+ });
1151
+
1152
+ describe('#deviceNewActionList - errors', () => {
1153
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1154
+ if (pronghorn.methodsByName.deviceNewActionList.task) {
1155
+ try {
1156
+ a.deviceNewActionList(deviceAPIId, null, (data, error) => {
1157
+ try {
1158
+ if (stub) {
1159
+ const displayE = 'Error 400 received on request';
1160
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1161
+ } else {
1162
+ runCommonAsserts(data, error);
1163
+ }
1164
+ saveMockData('DeviceAPI', 'deviceNewActionList', 'default', data);
1165
+ done();
1166
+ } catch (err) {
1167
+ log.error(`Test Failure: ${err}`);
1168
+ done(err);
1169
+ }
1170
+ });
1171
+ } catch (error) {
1172
+ log.error(`Adapter Exception: ${error}`);
1173
+ done(error);
1174
+ }
1175
+ } else {
1176
+ log.error('deviceNewActionList task is false, skipping test');
1177
+ skipCount += 1;
1178
+ done();
1179
+ }// end if task
1180
+ }).timeout(attemptTimeout);
1181
+ });
1182
+
1183
+ describe('#queuedActionDetail - errors', () => {
1184
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1185
+ if (pronghorn.methodsByName.queuedActionDetail.task) {
1186
+ try {
1187
+ a.queuedActionDetail(deviceAPIId, deviceAPIScriptRunId, (data, error) => {
1188
+ try {
1189
+ if (stub) {
1190
+ const displayE = 'Error 400 received on request';
1191
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1192
+ } else {
1193
+ runCommonAsserts(data, error);
1194
+ }
1195
+ saveMockData('DeviceAPI', 'queuedActionDetail', 'default', data);
1196
+ done();
1197
+ } catch (err) {
1198
+ log.error(`Test Failure: ${err}`);
1199
+ done(err);
1200
+ }
1201
+ });
1202
+ } catch (error) {
1203
+ log.error(`Adapter Exception: ${error}`);
1204
+ done(error);
1205
+ }
1206
+ } else {
1207
+ log.error('queuedActionDetail task is false, skipping test');
1208
+ skipCount += 1;
1209
+ done();
1210
+ }// end if task
1211
+ }).timeout(attemptTimeout);
1212
+ });
1213
+
1214
+ describe('#deviceStatisticsSummary - errors', () => {
1215
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1216
+ if (pronghorn.methodsByName.deviceStatisticsSummary.task) {
1217
+ try {
1218
+ a.deviceStatisticsSummary(deviceAPIId, (data, error) => {
1219
+ try {
1220
+ if (stub) {
1221
+ const displayE = 'Error 400 received on request';
1222
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1223
+ } else {
1224
+ runCommonAsserts(data, error);
1225
+ }
1226
+ saveMockData('DeviceAPI', 'deviceStatisticsSummary', 'default', data);
1227
+ done();
1228
+ } catch (err) {
1229
+ log.error(`Test Failure: ${err}`);
1230
+ done(err);
1231
+ }
1232
+ });
1233
+ } catch (error) {
1234
+ log.error(`Adapter Exception: ${error}`);
1235
+ done(error);
1236
+ }
1237
+ } else {
1238
+ log.error('deviceStatisticsSummary task is false, skipping test');
1239
+ skipCount += 1;
1240
+ done();
1241
+ }// end if task
1242
+ }).timeout(attemptTimeout);
1243
+ });
1244
+
1245
+ const deviceAPICreateDeviceAttributesBodyParam = {};
1246
+ describe('#createDeviceAttributes - errors', () => {
1247
+ it('should work if integrated or standalone with mockdata', (done) => {
1248
+ if (pronghorn.methodsByName.createDeviceAttributes.task) {
1249
+ try {
1250
+ a.createDeviceAttributes(deviceAPIId, null, deviceAPICreateDeviceAttributesBodyParam, (data, error) => {
1251
+ try {
1252
+ if (stub) {
1253
+ runCommonAsserts(data, error);
1254
+ assert.equal('success', data.response);
1255
+ } else {
1256
+ runCommonAsserts(data, error);
1257
+ }
1258
+ saveMockData('DeviceAPI', 'createDeviceAttributes', 'default', data);
1259
+ done();
1260
+ } catch (err) {
1261
+ log.error(`Test Failure: ${err}`);
1262
+ done(err);
1263
+ }
1264
+ });
1265
+ } catch (error) {
1266
+ log.error(`Adapter Exception: ${error}`);
1267
+ done(error);
1268
+ }
1269
+ } else {
1270
+ log.error('createDeviceAttributes task is false, skipping test');
1271
+ skipCount += 1;
1272
+ done();
1273
+ }// end if task
1274
+ }).timeout(attemptTimeout);
1275
+ });
1276
+
1277
+ describe('#deviceAttributeList - errors', () => {
1278
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1279
+ if (pronghorn.methodsByName.deviceAttributeList.task) {
1280
+ try {
1281
+ a.deviceAttributeList(deviceAPIId, null, null, null, null, null, (data, error) => {
1282
+ try {
1283
+ if (stub) {
1284
+ const displayE = 'Error 400 received on request';
1285
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1286
+ } else {
1287
+ runCommonAsserts(data, error);
1288
+ }
1289
+ saveMockData('DeviceAPI', 'deviceAttributeList', 'default', data);
1290
+ done();
1291
+ } catch (err) {
1292
+ log.error(`Test Failure: ${err}`);
1293
+ done(err);
1294
+ }
1295
+ });
1296
+ } catch (error) {
1297
+ log.error(`Adapter Exception: ${error}`);
1298
+ done(error);
1299
+ }
1300
+ } else {
1301
+ log.error('deviceAttributeList task is false, skipping test');
1302
+ skipCount += 1;
1303
+ done();
1304
+ }// end if task
1305
+ }).timeout(attemptTimeout);
1306
+ });
1307
+
1308
+ const deviceAPIRequestDeviceAttributeRefreshBodyParam = {};
1309
+ describe('#requestDeviceAttributeRefresh - errors', () => {
1310
+ it('should work if integrated or standalone with mockdata', (done) => {
1311
+ if (pronghorn.methodsByName.requestDeviceAttributeRefresh.task) {
1312
+ try {
1313
+ a.requestDeviceAttributeRefresh(deviceAPIId, deviceAPIRequestDeviceAttributeRefreshBodyParam, (data, error) => {
1314
+ try {
1315
+ if (stub) {
1316
+ runCommonAsserts(data, error);
1317
+ assert.equal('success', data.response);
1318
+ } else {
1319
+ runCommonAsserts(data, error);
1320
+ }
1321
+ saveMockData('DeviceAPI', 'requestDeviceAttributeRefresh', 'default', data);
1322
+ done();
1323
+ } catch (err) {
1324
+ log.error(`Test Failure: ${err}`);
1325
+ done(err);
1326
+ }
1327
+ });
1328
+ } catch (error) {
1329
+ log.error(`Adapter Exception: ${error}`);
1330
+ done(error);
1331
+ }
1332
+ } else {
1333
+ log.error('requestDeviceAttributeRefresh task is false, skipping test');
1334
+ skipCount += 1;
1335
+ done();
1336
+ }// end if task
1337
+ }).timeout(attemptTimeout);
1338
+ });
1339
+
1340
+ const deviceAPITriggerDeviceEventBodyParam = {
1341
+ event: 'INITIAL_CONTACT'
1342
+ };
1343
+ describe('#triggerDeviceEvent - errors', () => {
1344
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1345
+ if (pronghorn.methodsByName.triggerDeviceEvent.task) {
1346
+ try {
1347
+ a.triggerDeviceEvent(deviceAPIId, deviceAPITriggerDeviceEventBodyParam, (data, error) => {
1348
+ try {
1349
+ if (stub) {
1350
+ const displayE = 'Error 400 received on request';
1351
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1352
+ } else {
1353
+ runCommonAsserts(data, error);
1354
+ }
1355
+ saveMockData('DeviceAPI', 'triggerDeviceEvent', 'default', data);
1356
+ done();
1357
+ } catch (err) {
1358
+ log.error(`Test Failure: ${err}`);
1359
+ done(err);
1360
+ }
1361
+ });
1362
+ } catch (error) {
1363
+ log.error(`Adapter Exception: ${error}`);
1364
+ done(error);
1365
+ }
1366
+ } else {
1367
+ log.error('triggerDeviceEvent task is false, skipping test');
1368
+ skipCount += 1;
1369
+ done();
1370
+ }// end if task
1371
+ }).timeout(attemptTimeout);
1372
+ });
1373
+
1374
+ const deviceAPICreateDeviceLabelsBodyParam = [
1375
+ 'string'
1376
+ ];
1377
+ describe('#createDeviceLabels - errors', () => {
1378
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1379
+ if (pronghorn.methodsByName.createDeviceLabels.task) {
1380
+ try {
1381
+ a.createDeviceLabels(deviceAPIId, deviceAPICreateDeviceLabelsBodyParam, (data, error) => {
1382
+ try {
1383
+ if (stub) {
1384
+ const displayE = 'Error 400 received on request';
1385
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1386
+ } else {
1387
+ runCommonAsserts(data, error);
1388
+ }
1389
+ saveMockData('DeviceAPI', 'createDeviceLabels', 'default', data);
1390
+ done();
1391
+ } catch (err) {
1392
+ log.error(`Test Failure: ${err}`);
1393
+ done(err);
1394
+ }
1395
+ });
1396
+ } catch (error) {
1397
+ log.error(`Adapter Exception: ${error}`);
1398
+ done(error);
1399
+ }
1400
+ } else {
1401
+ log.error('createDeviceLabels task is false, skipping test');
1402
+ skipCount += 1;
1403
+ done();
1404
+ }// end if task
1405
+ }).timeout(attemptTimeout);
1406
+ });
1407
+
1408
+ describe('#deviceLabels - errors', () => {
1409
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1410
+ if (pronghorn.methodsByName.deviceLabels.task) {
1411
+ try {
1412
+ a.deviceLabels(deviceAPIId, (data, error) => {
1413
+ try {
1414
+ if (stub) {
1415
+ const displayE = 'Error 400 received on request';
1416
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1417
+ } else {
1418
+ runCommonAsserts(data, error);
1419
+ }
1420
+ saveMockData('DeviceAPI', 'deviceLabels', 'default', data);
1421
+ done();
1422
+ } catch (err) {
1423
+ log.error(`Test Failure: ${err}`);
1424
+ done(err);
1425
+ }
1426
+ });
1427
+ } catch (error) {
1428
+ log.error(`Adapter Exception: ${error}`);
1429
+ done(error);
1430
+ }
1431
+ } else {
1432
+ log.error('deviceLabels task is false, skipping test');
1433
+ skipCount += 1;
1434
+ done();
1435
+ }// end if task
1436
+ }).timeout(attemptTimeout);
1437
+ });
1438
+
1439
+ const deviceAPICreateDeviceUpdateQueueBodyParam = [
1440
+ {
1441
+ id: 10,
1442
+ lastStatus: 9
1443
+ }
1444
+ ];
1445
+ describe('#createDeviceUpdateQueue - errors', () => {
1446
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1447
+ if (pronghorn.methodsByName.createDeviceUpdateQueue.task) {
1448
+ try {
1449
+ a.createDeviceUpdateQueue(deviceAPIId, deviceAPICreateDeviceUpdateQueueBodyParam, (data, error) => {
1450
+ try {
1451
+ if (stub) {
1452
+ const displayE = 'Error 400 received on request';
1453
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1454
+ } else {
1455
+ runCommonAsserts(data, error);
1456
+ }
1457
+ saveMockData('DeviceAPI', 'createDeviceUpdateQueue', 'default', data);
1458
+ done();
1459
+ } catch (err) {
1460
+ log.error(`Test Failure: ${err}`);
1461
+ done(err);
1462
+ }
1463
+ });
1464
+ } catch (error) {
1465
+ log.error(`Adapter Exception: ${error}`);
1466
+ done(error);
1467
+ }
1468
+ } else {
1469
+ log.error('createDeviceUpdateQueue task is false, skipping test');
1470
+ skipCount += 1;
1471
+ done();
1472
+ }// end if task
1473
+ }).timeout(attemptTimeout);
1474
+ });
1475
+
1476
+ describe('#solicitStatus - errors', () => {
1477
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1478
+ if (pronghorn.methodsByName.solicitStatus.task) {
1479
+ try {
1480
+ a.solicitStatus(deviceAPIId, (data, error) => {
1481
+ try {
1482
+ if (stub) {
1483
+ const displayE = 'Error 400 received on request';
1484
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1485
+ } else {
1486
+ runCommonAsserts(data, error);
1487
+ }
1488
+ saveMockData('DeviceAPI', 'solicitStatus', 'default', data);
1489
+ done();
1490
+ } catch (err) {
1491
+ log.error(`Test Failure: ${err}`);
1492
+ done(err);
1493
+ }
1494
+ });
1495
+ } catch (error) {
1496
+ log.error(`Adapter Exception: ${error}`);
1497
+ done(error);
1498
+ }
1499
+ } else {
1500
+ log.error('solicitStatus task is false, skipping test');
1501
+ skipCount += 1;
1502
+ done();
1503
+ }// end if task
1504
+ }).timeout(attemptTimeout);
1505
+ });
1506
+
1507
+ const deviceAPICreateDeviceTraceLogBodyParam = {
1508
+ sessionId: 'string',
1509
+ begin: 7,
1510
+ hardwareVersion: 'string',
1511
+ softwareVersion: 'string',
1512
+ informEvents: [
1513
+ 'string'
1514
+ ],
1515
+ informCount: 8
1516
+ };
1517
+ describe('#createDeviceTraceLog - errors', () => {
1518
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1519
+ if (pronghorn.methodsByName.createDeviceTraceLog.task) {
1520
+ try {
1521
+ a.createDeviceTraceLog(deviceAPIId, deviceAPICreateDeviceTraceLogBodyParam, (data, error) => {
1522
+ try {
1523
+ if (stub) {
1524
+ const displayE = 'Error 400 received on request';
1525
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1526
+ } else {
1527
+ runCommonAsserts(data, error);
1528
+ }
1529
+ saveMockData('DeviceAPI', 'createDeviceTraceLog', 'default', data);
1530
+ done();
1531
+ } catch (err) {
1532
+ log.error(`Test Failure: ${err}`);
1533
+ done(err);
1534
+ }
1535
+ });
1536
+ } catch (error) {
1537
+ log.error(`Adapter Exception: ${error}`);
1538
+ done(error);
1539
+ }
1540
+ } else {
1541
+ log.error('createDeviceTraceLog task is false, skipping test');
1542
+ skipCount += 1;
1543
+ done();
1544
+ }// end if task
1545
+ }).timeout(attemptTimeout);
1546
+ });
1547
+
1548
+ describe('#deviceSessionTraceList - errors', () => {
1549
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1550
+ if (pronghorn.methodsByName.deviceSessionTraceList.task) {
1551
+ try {
1552
+ a.deviceSessionTraceList(deviceAPIId, (data, error) => {
1553
+ try {
1554
+ if (stub) {
1555
+ const displayE = 'Error 400 received on request';
1556
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1557
+ } else {
1558
+ runCommonAsserts(data, error);
1559
+ }
1560
+ saveMockData('DeviceAPI', 'deviceSessionTraceList', 'default', data);
1561
+ done();
1562
+ } catch (err) {
1563
+ log.error(`Test Failure: ${err}`);
1564
+ done(err);
1565
+ }
1566
+ });
1567
+ } catch (error) {
1568
+ log.error(`Adapter Exception: ${error}`);
1569
+ done(error);
1570
+ }
1571
+ } else {
1572
+ log.error('deviceSessionTraceList task is false, skipping test');
1573
+ skipCount += 1;
1574
+ done();
1575
+ }// end if task
1576
+ }).timeout(attemptTimeout);
1577
+ });
1578
+
1579
+ describe('#deviceTraceLevel - errors', () => {
1580
+ it('should work if integrated or standalone with mockdata', (done) => {
1581
+ if (pronghorn.methodsByName.deviceTraceLevel.task) {
1582
+ try {
1583
+ a.deviceTraceLevel(deviceAPIId, (data, error) => {
1584
+ try {
1585
+ if (stub) {
1586
+ runCommonAsserts(data, error);
1587
+ assert.equal('INFO', data.response.loggingLevel);
1588
+ } else {
1589
+ runCommonAsserts(data, error);
1590
+ }
1591
+ saveMockData('DeviceAPI', 'deviceTraceLevel', 'default', data);
1592
+ done();
1593
+ } catch (err) {
1594
+ log.error(`Test Failure: ${err}`);
1595
+ done(err);
1596
+ }
1597
+ });
1598
+ } catch (error) {
1599
+ log.error(`Adapter Exception: ${error}`);
1600
+ done(error);
1601
+ }
1602
+ } else {
1603
+ log.error('deviceTraceLevel task is false, skipping test');
1604
+ skipCount += 1;
1605
+ done();
1606
+ }// end if task
1607
+ }).timeout(attemptTimeout);
1608
+ });
1609
+
1610
+ const deviceAPITraceId = 555;
1611
+ describe('#deviceSessionTraceSummary - errors', () => {
1612
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1613
+ if (pronghorn.methodsByName.deviceSessionTraceSummary.task) {
1614
+ try {
1615
+ a.deviceSessionTraceSummary(deviceAPIId, deviceAPITraceId, (data, error) => {
1616
+ try {
1617
+ if (stub) {
1618
+ const displayE = 'Error 400 received on request';
1619
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1620
+ } else {
1621
+ runCommonAsserts(data, error);
1622
+ }
1623
+ saveMockData('DeviceAPI', 'deviceSessionTraceSummary', 'default', data);
1624
+ done();
1625
+ } catch (err) {
1626
+ log.error(`Test Failure: ${err}`);
1627
+ done(err);
1628
+ }
1629
+ });
1630
+ } catch (error) {
1631
+ log.error(`Adapter Exception: ${error}`);
1632
+ done(error);
1633
+ }
1634
+ } else {
1635
+ log.error('deviceSessionTraceSummary task is false, skipping test');
1636
+ skipCount += 1;
1637
+ done();
1638
+ }// end if task
1639
+ }).timeout(attemptTimeout);
1640
+ });
1641
+
1642
+ describe('#deviceSessionTraceDetail - errors', () => {
1643
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1644
+ if (pronghorn.methodsByName.deviceSessionTraceDetail.task) {
1645
+ try {
1646
+ a.deviceSessionTraceDetail(deviceAPIId, deviceAPITraceId, (data, error) => {
1647
+ try {
1648
+ if (stub) {
1649
+ const displayE = 'Error 400 received on request';
1650
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1651
+ } else {
1652
+ runCommonAsserts(data, error);
1653
+ }
1654
+ saveMockData('DeviceAPI', 'deviceSessionTraceDetail', 'default', data);
1655
+ done();
1656
+ } catch (err) {
1657
+ log.error(`Test Failure: ${err}`);
1658
+ done(err);
1659
+ }
1660
+ });
1661
+ } catch (error) {
1662
+ log.error(`Adapter Exception: ${error}`);
1663
+ done(error);
1664
+ }
1665
+ } else {
1666
+ log.error('deviceSessionTraceDetail task is false, skipping test');
1667
+ skipCount += 1;
1668
+ done();
1669
+ }// end if task
1670
+ }).timeout(attemptTimeout);
1671
+ });
1672
+
1673
+ const deviceAPIDays = 555;
1674
+ describe('#countOfDevicesByDeviceType - errors', () => {
1675
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1676
+ if (pronghorn.methodsByName.countOfDevicesByDeviceType.task) {
1677
+ try {
1678
+ a.countOfDevicesByDeviceType(deviceAPIFirst, deviceAPICount, deviceAPIDays, (data, error) => {
1679
+ try {
1680
+ if (stub) {
1681
+ const displayE = 'Error 400 received on request';
1682
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1683
+ } else {
1684
+ runCommonAsserts(data, error);
1685
+ }
1686
+ saveMockData('DeviceAPI', 'countOfDevicesByDeviceType', 'default', data);
1687
+ done();
1688
+ } catch (err) {
1689
+ log.error(`Test Failure: ${err}`);
1690
+ done(err);
1691
+ }
1692
+ });
1693
+ } catch (error) {
1694
+ log.error(`Adapter Exception: ${error}`);
1695
+ done(error);
1696
+ }
1697
+ } else {
1698
+ log.error('countOfDevicesByDeviceType task is false, skipping test');
1699
+ skipCount += 1;
1700
+ done();
1701
+ }// end if task
1702
+ }).timeout(attemptTimeout);
1703
+ });
1704
+
1705
+ describe('#countOfSubscribersByLabel - errors', () => {
1706
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1707
+ if (pronghorn.methodsByName.countOfSubscribersByLabel.task) {
1708
+ try {
1709
+ a.countOfSubscribersByLabel(deviceAPIFirst, deviceAPICount, (data, error) => {
1710
+ try {
1711
+ if (stub) {
1712
+ const displayE = 'Error 400 received on request';
1713
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1714
+ } else {
1715
+ runCommonAsserts(data, error);
1716
+ }
1717
+ saveMockData('DeviceAPI', 'countOfSubscribersByLabel', 'default', data);
1718
+ done();
1719
+ } catch (err) {
1720
+ log.error(`Test Failure: ${err}`);
1721
+ done(err);
1722
+ }
1723
+ });
1724
+ } catch (error) {
1725
+ log.error(`Adapter Exception: ${error}`);
1726
+ done(error);
1727
+ }
1728
+ } else {
1729
+ log.error('countOfSubscribersByLabel task is false, skipping test');
1730
+ skipCount += 1;
1731
+ done();
1732
+ }// end if task
1733
+ }).timeout(attemptTimeout);
1734
+ });
1735
+
1736
+ describe('#deviceStatisticsByManufacturer - errors', () => {
1737
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1738
+ if (pronghorn.methodsByName.deviceStatisticsByManufacturer.task) {
1739
+ try {
1740
+ a.deviceStatisticsByManufacturer((data, error) => {
1741
+ try {
1742
+ if (stub) {
1743
+ const displayE = 'Error 400 received on request';
1744
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1745
+ } else {
1746
+ runCommonAsserts(data, error);
1747
+ }
1748
+ saveMockData('DeviceAPI', 'deviceStatisticsByManufacturer', 'default', data);
1749
+ done();
1750
+ } catch (err) {
1751
+ log.error(`Test Failure: ${err}`);
1752
+ done(err);
1753
+ }
1754
+ });
1755
+ } catch (error) {
1756
+ log.error(`Adapter Exception: ${error}`);
1757
+ done(error);
1758
+ }
1759
+ } else {
1760
+ log.error('deviceStatisticsByManufacturer task is false, skipping test');
1761
+ skipCount += 1;
1762
+ done();
1763
+ }// end if task
1764
+ }).timeout(attemptTimeout);
1765
+ });
1766
+
1767
+ const deviceAPIManufacturer = 'fakedata';
1768
+ describe('#countsOfDeviceClassesByManufacturer - errors', () => {
1769
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1770
+ if (pronghorn.methodsByName.countsOfDeviceClassesByManufacturer.task) {
1771
+ try {
1772
+ a.countsOfDeviceClassesByManufacturer(deviceAPIManufacturer, (data, error) => {
1773
+ try {
1774
+ if (stub) {
1775
+ const displayE = 'Error 400 received on request';
1776
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1777
+ } else {
1778
+ runCommonAsserts(data, error);
1779
+ }
1780
+ saveMockData('DeviceAPI', 'countsOfDeviceClassesByManufacturer', 'default', data);
1781
+ done();
1782
+ } catch (err) {
1783
+ log.error(`Test Failure: ${err}`);
1784
+ done(err);
1785
+ }
1786
+ });
1787
+ } catch (error) {
1788
+ log.error(`Adapter Exception: ${error}`);
1789
+ done(error);
1790
+ }
1791
+ } else {
1792
+ log.error('countsOfDeviceClassesByManufacturer task is false, skipping test');
1793
+ skipCount += 1;
1794
+ done();
1795
+ }// end if task
1796
+ }).timeout(attemptTimeout);
1797
+ });
1798
+
1799
+ describe('#countOfDevicesCheckedInFor7Days - errors', () => {
1800
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1801
+ if (pronghorn.methodsByName.countOfDevicesCheckedInFor7Days.task) {
1802
+ try {
1803
+ a.countOfDevicesCheckedInFor7Days((data, error) => {
1804
+ try {
1805
+ if (stub) {
1806
+ const displayE = 'Error 400 received on request';
1807
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1808
+ } else {
1809
+ runCommonAsserts(data, error);
1810
+ }
1811
+ saveMockData('DeviceAPI', 'countOfDevicesCheckedInFor7Days', 'default', data);
1812
+ done();
1813
+ } catch (err) {
1814
+ log.error(`Test Failure: ${err}`);
1815
+ done(err);
1816
+ }
1817
+ });
1818
+ } catch (error) {
1819
+ log.error(`Adapter Exception: ${error}`);
1820
+ done(error);
1821
+ }
1822
+ } else {
1823
+ log.error('countOfDevicesCheckedInFor7Days task is false, skipping test');
1824
+ skipCount += 1;
1825
+ done();
1826
+ }// end if task
1827
+ }).timeout(attemptTimeout);
1828
+ });
1829
+
1830
+ describe('#dailyDeviceCountsFor7Days - errors', () => {
1831
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1832
+ if (pronghorn.methodsByName.dailyDeviceCountsFor7Days.task) {
1833
+ try {
1834
+ a.dailyDeviceCountsFor7Days((data, error) => {
1835
+ try {
1836
+ if (stub) {
1837
+ const displayE = 'Error 400 received on request';
1838
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1839
+ } else {
1840
+ runCommonAsserts(data, error);
1841
+ }
1842
+ saveMockData('DeviceAPI', 'dailyDeviceCountsFor7Days', 'default', data);
1843
+ done();
1844
+ } catch (err) {
1845
+ log.error(`Test Failure: ${err}`);
1846
+ done(err);
1847
+ }
1848
+ });
1849
+ } catch (error) {
1850
+ log.error(`Adapter Exception: ${error}`);
1851
+ done(error);
1852
+ }
1853
+ } else {
1854
+ log.error('dailyDeviceCountsFor7Days task is false, skipping test');
1855
+ skipCount += 1;
1856
+ done();
1857
+ }// end if task
1858
+ }).timeout(attemptTimeout);
1859
+ });
1860
+
1861
+ const deviceAPIDeviceIds = 'fakedata';
1862
+ describe('#deviceSolicitStatus - errors', () => {
1863
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1864
+ if (pronghorn.methodsByName.deviceSolicitStatus.task) {
1865
+ try {
1866
+ a.deviceSolicitStatus(deviceAPIDeviceIds, (data, error) => {
1867
+ try {
1868
+ if (stub) {
1869
+ const displayE = 'Error 400 received on request';
1870
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1871
+ } else {
1872
+ runCommonAsserts(data, error);
1873
+ }
1874
+ saveMockData('DeviceAPI', 'deviceSolicitStatus', 'default', data);
1875
+ done();
1876
+ } catch (err) {
1877
+ log.error(`Test Failure: ${err}`);
1878
+ done(err);
1879
+ }
1880
+ });
1881
+ } catch (error) {
1882
+ log.error(`Adapter Exception: ${error}`);
1883
+ done(error);
1884
+ }
1885
+ } else {
1886
+ log.error('deviceSolicitStatus task is false, skipping test');
1887
+ skipCount += 1;
1888
+ done();
1889
+ }// end if task
1890
+ }).timeout(attemptTimeout);
1891
+ });
1892
+
1893
+ const deviceAPIUpdateDeviceStatusBodyParam = [
1894
+ {
1895
+ id: 2
1896
+ }
1897
+ ];
1898
+ describe('#updateDeviceStatus - errors', () => {
1899
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1900
+ if (pronghorn.methodsByName.updateDeviceStatus.task) {
1901
+ try {
1902
+ a.updateDeviceStatus(deviceAPIDeviceId, deviceAPIUpdateDeviceStatusBodyParam, (data, error) => {
1903
+ try {
1904
+ if (stub) {
1905
+ const displayE = 'Error 400 received on request';
1906
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1907
+ } else {
1908
+ runCommonAsserts(data, error);
1909
+ }
1910
+ saveMockData('DeviceAPI', 'updateDeviceStatus', 'default', data);
1911
+ done();
1912
+ } catch (err) {
1913
+ log.error(`Test Failure: ${err}`);
1914
+ done(err);
1915
+ }
1916
+ });
1917
+ } catch (error) {
1918
+ log.error(`Adapter Exception: ${error}`);
1919
+ done(error);
1920
+ }
1921
+ } else {
1922
+ log.error('updateDeviceStatus task is false, skipping test');
1923
+ skipCount += 1;
1924
+ done();
1925
+ }// end if task
1926
+ }).timeout(attemptTimeout);
1927
+ });
1928
+
1929
+ const subscriberAPICreateNewACSSubscriberPOSTBodyParam = {
1930
+ dto: {
1931
+ Subscriber: {
1932
+ FullName: 'string',
1933
+ EmailAddress: 'string'
1934
+ },
1935
+ subscriptions: [
1936
+ 'string'
1937
+ ],
1938
+ labels: [
1939
+ 'string'
1940
+ ],
1941
+ credentials: {},
1942
+ code: 'string'
1943
+ }
1944
+ };
1945
+ describe('#createNewACSSubscriberPOST - errors', () => {
1946
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1947
+ if (pronghorn.methodsByName.createNewACSSubscriberPOST.task) {
1948
+ try {
1949
+ a.createNewACSSubscriberPOST(subscriberAPICreateNewACSSubscriberPOSTBodyParam, (data, error) => {
1950
+ try {
1951
+ if (stub) {
1952
+ const displayE = 'Error 400 received on request';
1953
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1954
+ } else {
1955
+ runCommonAsserts(data, error);
1956
+ }
1957
+ saveMockData('SubscriberAPI', 'createNewACSSubscriberPOST', 'default', data);
1958
+ done();
1959
+ } catch (err) {
1960
+ log.error(`Test Failure: ${err}`);
1961
+ done(err);
1962
+ }
1963
+ });
1964
+ } catch (error) {
1965
+ log.error(`Adapter Exception: ${error}`);
1966
+ done(error);
1967
+ }
1968
+ } else {
1969
+ log.error('createNewACSSubscriberPOST task is false, skipping test');
1970
+ skipCount += 1;
1971
+ done();
1972
+ }// end if task
1973
+ }).timeout(attemptTimeout);
1974
+ });
1975
+
1976
+ const subscriberAPICreateSubscriberLoginSessionsBodyParam = {
1977
+ login: 'string',
1978
+ password: 'string'
1979
+ };
1980
+ describe('#createSubscriberLoginSessions - errors', () => {
1981
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1982
+ if (pronghorn.methodsByName.createSubscriberLoginSessions.task) {
1983
+ try {
1984
+ a.createSubscriberLoginSessions(subscriberAPICreateSubscriberLoginSessionsBodyParam, (data, error) => {
1985
+ try {
1986
+ if (stub) {
1987
+ const displayE = 'Error 400 received on request';
1988
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
1989
+ } else {
1990
+ runCommonAsserts(data, error);
1991
+ }
1992
+ saveMockData('SubscriberAPI', 'createSubscriberLoginSessions', 'default', data);
1993
+ done();
1994
+ } catch (err) {
1995
+ log.error(`Test Failure: ${err}`);
1996
+ done(err);
1997
+ }
1998
+ });
1999
+ } catch (error) {
2000
+ log.error(`Adapter Exception: ${error}`);
2001
+ done(error);
2002
+ }
2003
+ } else {
2004
+ log.error('createSubscriberLoginSessions task is false, skipping test');
2005
+ skipCount += 1;
2006
+ done();
2007
+ }// end if task
2008
+ }).timeout(attemptTimeout);
2009
+ });
2010
+
2011
+ const subscriberAPITokenId = 'fakedata';
2012
+ const subscriberAPISubscriberLoginSessionBodyParam = {
2013
+ cpSessionId: 'string'
2014
+ };
2015
+ describe('#subscriberLoginSession - errors', () => {
2016
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2017
+ if (pronghorn.methodsByName.subscriberLoginSession.task) {
2018
+ try {
2019
+ a.subscriberLoginSession(subscriberAPITokenId, subscriberAPISubscriberLoginSessionBodyParam, (data, error) => {
2020
+ try {
2021
+ if (stub) {
2022
+ const displayE = 'Error 400 received on request';
2023
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2024
+ } else {
2025
+ runCommonAsserts(data, error);
2026
+ }
2027
+ saveMockData('SubscriberAPI', 'subscriberLoginSession', 'default', data);
2028
+ done();
2029
+ } catch (err) {
2030
+ log.error(`Test Failure: ${err}`);
2031
+ done(err);
2032
+ }
2033
+ });
2034
+ } catch (error) {
2035
+ log.error(`Adapter Exception: ${error}`);
2036
+ done(error);
2037
+ }
2038
+ } else {
2039
+ log.error('subscriberLoginSession task is false, skipping test');
2040
+ skipCount += 1;
2041
+ done();
2042
+ }// end if task
2043
+ }).timeout(attemptTimeout);
2044
+ });
2045
+
2046
+ let subscriberAPIPersonId = 'fakedata';
2047
+ const subscriberAPIModifySubscriberBodyParam = {
2048
+ code: 'string'
2049
+ };
2050
+ describe('#modifySubscriber - errors', () => {
2051
+ it('should work if integrated or standalone with mockdata', (done) => {
2052
+ if (pronghorn.methodsByName.modifySubscriber.task) {
2053
+ try {
2054
+ a.modifySubscriber(subscriberAPIPersonId, subscriberAPIModifySubscriberBodyParam, (data, error) => {
2055
+ try {
2056
+ if (stub) {
2057
+ runCommonAsserts(data, error);
2058
+ assert.equal(7, data.response.id);
2059
+ assert.equal('string', data.response.code);
2060
+ } else {
2061
+ runCommonAsserts(data, error);
2062
+ }
2063
+ subscriberAPIPersonId = data.response.id;
2064
+ saveMockData('SubscriberAPI', 'modifySubscriber', 'default', data);
2065
+ done();
2066
+ } catch (err) {
2067
+ log.error(`Test Failure: ${err}`);
2068
+ done(err);
2069
+ }
2070
+ });
2071
+ } catch (error) {
2072
+ log.error(`Adapter Exception: ${error}`);
2073
+ done(error);
2074
+ }
2075
+ } else {
2076
+ log.error('modifySubscriber task is false, skipping test');
2077
+ skipCount += 1;
2078
+ done();
2079
+ }// end if task
2080
+ }).timeout(attemptTimeout);
2081
+ });
2082
+
2083
+ const subscriberAPISubscriberAttributesBodyParam = {};
2084
+ describe('#subscriberAttributes - errors', () => {
2085
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2086
+ if (pronghorn.methodsByName.subscriberAttributes.task) {
2087
+ try {
2088
+ a.subscriberAttributes(subscriberAPIPersonId, subscriberAPISubscriberAttributesBodyParam, (data, error) => {
2089
+ try {
2090
+ if (stub) {
2091
+ const displayE = 'Error 400 received on request';
2092
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2093
+ } else {
2094
+ runCommonAsserts(data, error);
2095
+ }
2096
+ saveMockData('SubscriberAPI', 'subscriberAttributes', 'default', data);
2097
+ done();
2098
+ } catch (err) {
2099
+ log.error(`Test Failure: ${err}`);
2100
+ done(err);
2101
+ }
2102
+ });
2103
+ } catch (error) {
2104
+ log.error(`Adapter Exception: ${error}`);
2105
+ done(error);
2106
+ }
2107
+ } else {
2108
+ log.error('subscriberAttributes task is false, skipping test');
2109
+ skipCount += 1;
2110
+ done();
2111
+ }// end if task
2112
+ }).timeout(attemptTimeout);
2113
+ });
2114
+
2115
+ const subscriberAPIChangePasswordBodyParam = {
2116
+ currentPassword: 'string',
2117
+ newPassword: 'string'
2118
+ };
2119
+ describe('#changePassword - errors', () => {
2120
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2121
+ if (pronghorn.methodsByName.changePassword.task) {
2122
+ try {
2123
+ a.changePassword(subscriberAPIPersonId, subscriberAPIChangePasswordBodyParam, (data, error) => {
2124
+ try {
2125
+ if (stub) {
2126
+ const displayE = 'Error 400 received on request';
2127
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2128
+ } else {
2129
+ runCommonAsserts(data, error);
2130
+ }
2131
+ saveMockData('SubscriberAPI', 'changePassword', 'default', data);
2132
+ done();
2133
+ } catch (err) {
2134
+ log.error(`Test Failure: ${err}`);
2135
+ done(err);
2136
+ }
2137
+ });
2138
+ } catch (error) {
2139
+ log.error(`Adapter Exception: ${error}`);
2140
+ done(error);
2141
+ }
2142
+ } else {
2143
+ log.error('changePassword task is false, skipping test');
2144
+ skipCount += 1;
2145
+ done();
2146
+ }// end if task
2147
+ }).timeout(attemptTimeout);
2148
+ });
2149
+
2150
+ const subscriberAPIDefineLabelsForSubscriberBodyParam = [
2151
+ 'string'
2152
+ ];
2153
+ describe('#defineLabelsForSubscriber - errors', () => {
2154
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2155
+ if (pronghorn.methodsByName.defineLabelsForSubscriber.task) {
2156
+ try {
2157
+ a.defineLabelsForSubscriber(subscriberAPIPersonId, subscriberAPIDefineLabelsForSubscriberBodyParam, (data, error) => {
2158
+ try {
2159
+ if (stub) {
2160
+ const displayE = 'Error 400 received on request';
2161
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2162
+ } else {
2163
+ runCommonAsserts(data, error);
2164
+ }
2165
+ saveMockData('SubscriberAPI', 'defineLabelsForSubscriber', 'default', data);
2166
+ done();
2167
+ } catch (err) {
2168
+ log.error(`Test Failure: ${err}`);
2169
+ done(err);
2170
+ }
2171
+ });
2172
+ } catch (error) {
2173
+ log.error(`Adapter Exception: ${error}`);
2174
+ done(error);
2175
+ }
2176
+ } else {
2177
+ log.error('defineLabelsForSubscriber task is false, skipping test');
2178
+ skipCount += 1;
2179
+ done();
2180
+ }// end if task
2181
+ }).timeout(attemptTimeout);
2182
+ });
2183
+
2184
+ const subscriberAPIManagementGroupId = 'fakedata';
2185
+ const subscriberAPIModifySubscriberManagementGroupBodyParam = {
2186
+ managedDevice: {
2187
+ id: 5
2188
+ },
2189
+ deviceSignature: {
2190
+ oui: 'string',
2191
+ serialNumber: 'string',
2192
+ provisioningCode: 'string',
2193
+ cpProvisioningId: 6
2194
+ }
2195
+ };
2196
+ describe('#modifySubscriberManagementGroup - errors', () => {
2197
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2198
+ if (pronghorn.methodsByName.modifySubscriberManagementGroup.task) {
2199
+ try {
2200
+ a.modifySubscriberManagementGroup(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIModifySubscriberManagementGroupBodyParam, (data, error) => {
2201
+ try {
2202
+ if (stub) {
2203
+ const displayE = 'Error 400 received on request';
2204
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2205
+ } else {
2206
+ runCommonAsserts(data, error);
2207
+ }
2208
+ saveMockData('SubscriberAPI', 'modifySubscriberManagementGroup', 'default', data);
2209
+ done();
2210
+ } catch (err) {
2211
+ log.error(`Test Failure: ${err}`);
2212
+ done(err);
2213
+ }
2214
+ });
2215
+ } catch (error) {
2216
+ log.error(`Adapter Exception: ${error}`);
2217
+ done(error);
2218
+ }
2219
+ } else {
2220
+ log.error('modifySubscriberManagementGroup task is false, skipping test');
2221
+ skipCount += 1;
2222
+ done();
2223
+ }// end if task
2224
+ }).timeout(attemptTimeout);
2225
+ });
2226
+
2227
+ const subscriberAPIManagementGroupBodyParam = {
2228
+ oui: 'string',
2229
+ serialNumber: 'string',
2230
+ provisioningCode: 'string',
2231
+ cpProvisioningId: 5
2232
+ };
2233
+ describe('#managementGroup - errors', () => {
2234
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2235
+ if (pronghorn.methodsByName.managementGroup.task) {
2236
+ try {
2237
+ a.managementGroup(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIManagementGroupBodyParam, (data, error) => {
2238
+ try {
2239
+ if (stub) {
2240
+ const displayE = 'Error 400 received on request';
2241
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2242
+ } else {
2243
+ runCommonAsserts(data, error);
2244
+ }
2245
+ saveMockData('SubscriberAPI', 'managementGroup', 'default', data);
2246
+ done();
2247
+ } catch (err) {
2248
+ log.error(`Test Failure: ${err}`);
2249
+ done(err);
2250
+ }
2251
+ });
2252
+ } catch (error) {
2253
+ log.error(`Adapter Exception: ${error}`);
2254
+ done(error);
2255
+ }
2256
+ } else {
2257
+ log.error('managementGroup task is false, skipping test');
2258
+ skipCount += 1;
2259
+ done();
2260
+ }// end if task
2261
+ }).timeout(attemptTimeout);
2262
+ });
2263
+
2264
+ const subscriberAPIPackageName = 'fakedata';
2265
+ const subscriberAPISubscriptionPackageStatusBodyParam = {
2266
+ status: 'ENABLED'
2267
+ };
2268
+ describe('#subscriptionPackageStatus - errors', () => {
2269
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2270
+ if (pronghorn.methodsByName.subscriptionPackageStatus.task) {
2271
+ try {
2272
+ a.subscriptionPackageStatus(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIPackageName, subscriberAPISubscriptionPackageStatusBodyParam, (data, error) => {
2273
+ try {
2274
+ if (stub) {
2275
+ const displayE = 'Error 400 received on request';
2276
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2277
+ } else {
2278
+ runCommonAsserts(data, error);
2279
+ }
2280
+ saveMockData('SubscriberAPI', 'subscriptionPackageStatus', 'default', data);
2281
+ done();
2282
+ } catch (err) {
2283
+ log.error(`Test Failure: ${err}`);
2284
+ done(err);
2285
+ }
2286
+ });
2287
+ } catch (error) {
2288
+ log.error(`Adapter Exception: ${error}`);
2289
+ done(error);
2290
+ }
2291
+ } else {
2292
+ log.error('subscriptionPackageStatus task is false, skipping test');
2293
+ skipCount += 1;
2294
+ done();
2295
+ }// end if task
2296
+ }).timeout(attemptTimeout);
2297
+ });
2298
+
2299
+ const subscriberAPILogin = 'fakedata';
2300
+ const subscriberAPIModifyUserDetailsBodyParam = {
2301
+ login: 'string',
2302
+ fullname: 'string',
2303
+ email: 'string',
2304
+ password: 'string',
2305
+ enabled: true,
2306
+ domains: [
2307
+ 'string'
2308
+ ]
2309
+ };
2310
+ describe('#modifyUserDetails - errors', () => {
2311
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2312
+ if (pronghorn.methodsByName.modifyUserDetails.task) {
2313
+ try {
2314
+ a.modifyUserDetails(subscriberAPILogin, subscriberAPIModifyUserDetailsBodyParam, (data, error) => {
2315
+ try {
2316
+ if (stub) {
2317
+ const displayE = 'Error 400 received on request';
2318
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2319
+ } else {
2320
+ runCommonAsserts(data, error);
2321
+ }
2322
+ saveMockData('SubscriberAPI', 'modifyUserDetails', 'default', data);
2323
+ done();
2324
+ } catch (err) {
2325
+ log.error(`Test Failure: ${err}`);
2326
+ done(err);
2327
+ }
2328
+ });
2329
+ } catch (error) {
2330
+ log.error(`Adapter Exception: ${error}`);
2331
+ done(error);
2332
+ }
2333
+ } else {
2334
+ log.error('modifyUserDetails task is false, skipping test');
2335
+ skipCount += 1;
2336
+ done();
2337
+ }// end if task
2338
+ }).timeout(attemptTimeout);
2339
+ });
2340
+
2341
+ const subscriberAPICreateUserLabelsBodyParam = [
2342
+ 'string'
2343
+ ];
2344
+ describe('#createUserLabels - errors', () => {
2345
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2346
+ if (pronghorn.methodsByName.createUserLabels.task) {
2347
+ try {
2348
+ a.createUserLabels(subscriberAPILogin, subscriberAPICreateUserLabelsBodyParam, (data, error) => {
2349
+ try {
2350
+ if (stub) {
2351
+ const displayE = 'Error 400 received on request';
2352
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2353
+ } else {
2354
+ runCommonAsserts(data, error);
2355
+ }
2356
+ saveMockData('SubscriberAPI', 'createUserLabels', 'default', data);
2357
+ done();
2358
+ } catch (err) {
2359
+ log.error(`Test Failure: ${err}`);
2360
+ done(err);
2361
+ }
2362
+ });
2363
+ } catch (error) {
2364
+ log.error(`Adapter Exception: ${error}`);
2365
+ done(error);
2366
+ }
2367
+ } else {
2368
+ log.error('createUserLabels task is false, skipping test');
2369
+ skipCount += 1;
2370
+ done();
2371
+ }// end if task
2372
+ }).timeout(attemptTimeout);
2373
+ });
2374
+
2375
+ const subscriberAPIModifyUserPreferencesBodyParam = {
2376
+ language: 'es'
2377
+ };
2378
+ describe('#modifyUserPreferences - errors', () => {
2379
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2380
+ if (pronghorn.methodsByName.modifyUserPreferences.task) {
2381
+ try {
2382
+ a.modifyUserPreferences(subscriberAPILogin, subscriberAPIModifyUserPreferencesBodyParam, (data, error) => {
2383
+ try {
2384
+ if (stub) {
2385
+ const displayE = 'Error 400 received on request';
2386
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2387
+ } else {
2388
+ runCommonAsserts(data, error);
2389
+ }
2390
+ saveMockData('SubscriberAPI', 'modifyUserPreferences', 'default', data);
2391
+ done();
2392
+ } catch (err) {
2393
+ log.error(`Test Failure: ${err}`);
2394
+ done(err);
2395
+ }
2396
+ });
2397
+ } catch (error) {
2398
+ log.error(`Adapter Exception: ${error}`);
2399
+ done(error);
2400
+ }
2401
+ } else {
2402
+ log.error('modifyUserPreferences task is false, skipping test');
2403
+ skipCount += 1;
2404
+ done();
2405
+ }// end if task
2406
+ }).timeout(attemptTimeout);
2407
+ });
2408
+
2409
+ const subscriberAPICreateUserRolesBodyParam = [
2410
+ 'string'
2411
+ ];
2412
+ describe('#createUserRoles - errors', () => {
2413
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2414
+ if (pronghorn.methodsByName.createUserRoles.task) {
2415
+ try {
2416
+ a.createUserRoles(subscriberAPILogin, subscriberAPICreateUserRolesBodyParam, (data, error) => {
2417
+ try {
2418
+ if (stub) {
2419
+ const displayE = 'Error 400 received on request';
2420
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2421
+ } else {
2422
+ runCommonAsserts(data, error);
2423
+ }
2424
+ saveMockData('SubscriberAPI', 'createUserRoles', 'default', data);
2425
+ done();
2426
+ } catch (err) {
2427
+ log.error(`Test Failure: ${err}`);
2428
+ done(err);
2429
+ }
2430
+ });
2431
+ } catch (error) {
2432
+ log.error(`Adapter Exception: ${error}`);
2433
+ done(error);
2434
+ }
2435
+ } else {
2436
+ log.error('createUserRoles task is false, skipping test');
2437
+ skipCount += 1;
2438
+ done();
2439
+ }// end if task
2440
+ }).timeout(attemptTimeout);
2441
+ });
2442
+
2443
+ describe('#sessionExpirationStatus - errors', () => {
2444
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2445
+ if (pronghorn.methodsByName.sessionExpirationStatus.task) {
2446
+ try {
2447
+ a.sessionExpirationStatus((data, error) => {
2448
+ try {
2449
+ if (stub) {
2450
+ const displayE = 'Error 400 received on request';
2451
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2452
+ } else {
2453
+ runCommonAsserts(data, error);
2454
+ }
2455
+ saveMockData('SubscriberAPI', 'sessionExpirationStatus', 'default', data);
2456
+ done();
2457
+ } catch (err) {
2458
+ log.error(`Test Failure: ${err}`);
2459
+ done(err);
2460
+ }
2461
+ });
2462
+ } catch (error) {
2463
+ log.error(`Adapter Exception: ${error}`);
2464
+ done(error);
2465
+ }
2466
+ } else {
2467
+ log.error('sessionExpirationStatus task is false, skipping test');
2468
+ skipCount += 1;
2469
+ done();
2470
+ }// end if task
2471
+ }).timeout(attemptTimeout);
2472
+ });
2473
+
2474
+ const subscriberAPIFilter = 'fakedata';
2475
+ describe('#getMetaDataForSubscribers - errors', () => {
2476
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2477
+ if (pronghorn.methodsByName.getMetaDataForSubscribers.task) {
2478
+ try {
2479
+ a.getMetaDataForSubscribers(subscriberAPIFilter, (data, error) => {
2480
+ try {
2481
+ if (stub) {
2482
+ const displayE = 'Error 400 received on request';
2483
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2484
+ } else {
2485
+ runCommonAsserts(data, error);
2486
+ }
2487
+ saveMockData('SubscriberAPI', 'getMetaDataForSubscribers', 'default', data);
2488
+ done();
2489
+ } catch (err) {
2490
+ log.error(`Test Failure: ${err}`);
2491
+ done(err);
2492
+ }
2493
+ });
2494
+ } catch (error) {
2495
+ log.error(`Adapter Exception: ${error}`);
2496
+ done(error);
2497
+ }
2498
+ } else {
2499
+ log.error('getMetaDataForSubscribers task is false, skipping test');
2500
+ skipCount += 1;
2501
+ done();
2502
+ }// end if task
2503
+ }).timeout(attemptTimeout);
2504
+ });
2505
+
2506
+ describe('#aCSSubscriberList - errors', () => {
2507
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2508
+ if (pronghorn.methodsByName.aCSSubscriberList.task) {
2509
+ try {
2510
+ a.aCSSubscriberList((data, error) => {
2511
+ try {
2512
+ if (stub) {
2513
+ const displayE = 'Error 400 received on request';
2514
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2515
+ } else {
2516
+ runCommonAsserts(data, error);
2517
+ }
2518
+ saveMockData('SubscriberAPI', 'aCSSubscriberList', 'default', data);
2519
+ done();
2520
+ } catch (err) {
2521
+ log.error(`Test Failure: ${err}`);
2522
+ done(err);
2523
+ }
2524
+ });
2525
+ } catch (error) {
2526
+ log.error(`Adapter Exception: ${error}`);
2527
+ done(error);
2528
+ }
2529
+ } else {
2530
+ log.error('aCSSubscriberList task is false, skipping test');
2531
+ skipCount += 1;
2532
+ done();
2533
+ }// end if task
2534
+ }).timeout(attemptTimeout);
2535
+ });
2536
+
2537
+ const subscriberAPIRequestPasswordChangeBodyParam = {
2538
+ email: 'string',
2539
+ locale: 'string'
2540
+ };
2541
+ describe('#requestPasswordChange - errors', () => {
2542
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2543
+ if (pronghorn.methodsByName.requestPasswordChange.task) {
2544
+ try {
2545
+ a.requestPasswordChange(subscriberAPIRequestPasswordChangeBodyParam, (data, error) => {
2546
+ try {
2547
+ if (stub) {
2548
+ const displayE = 'Error 400 received on request';
2549
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2550
+ } else {
2551
+ runCommonAsserts(data, error);
2552
+ }
2553
+ saveMockData('SubscriberAPI', 'requestPasswordChange', 'default', data);
2554
+ done();
2555
+ } catch (err) {
2556
+ log.error(`Test Failure: ${err}`);
2557
+ done(err);
2558
+ }
2559
+ });
2560
+ } catch (error) {
2561
+ log.error(`Adapter Exception: ${error}`);
2562
+ done(error);
2563
+ }
2564
+ } else {
2565
+ log.error('requestPasswordChange task is false, skipping test');
2566
+ skipCount += 1;
2567
+ done();
2568
+ }// end if task
2569
+ }).timeout(attemptTimeout);
2570
+ });
2571
+
2572
+ describe('#statisticsForSubscribers - errors', () => {
2573
+ it('should work if integrated or standalone with mockdata', (done) => {
2574
+ if (pronghorn.methodsByName.statisticsForSubscribers.task) {
2575
+ try {
2576
+ a.statisticsForSubscribers((data, error) => {
2577
+ try {
2578
+ if (stub) {
2579
+ runCommonAsserts(data, error);
2580
+ assert.equal(5, data.response.totalActiveSubscribers);
2581
+ } else {
2582
+ runCommonAsserts(data, error);
2583
+ }
2584
+ saveMockData('SubscriberAPI', 'statisticsForSubscribers', 'default', data);
2585
+ done();
2586
+ } catch (err) {
2587
+ log.error(`Test Failure: ${err}`);
2588
+ done(err);
2589
+ }
2590
+ });
2591
+ } catch (error) {
2592
+ log.error(`Adapter Exception: ${error}`);
2593
+ done(error);
2594
+ }
2595
+ } else {
2596
+ log.error('statisticsForSubscribers task is false, skipping test');
2597
+ skipCount += 1;
2598
+ done();
2599
+ }// end if task
2600
+ }).timeout(attemptTimeout);
2601
+ });
2602
+
2603
+ describe('#statisticsForSpecificSubscriber - errors', () => {
2604
+ it('should work if integrated or standalone with mockdata', (done) => {
2605
+ if (pronghorn.methodsByName.statisticsForSpecificSubscriber.task) {
2606
+ try {
2607
+ a.statisticsForSpecificSubscriber(subscriberAPIPersonId, (data, error) => {
2608
+ try {
2609
+ if (stub) {
2610
+ runCommonAsserts(data, error);
2611
+ assert.equal(9, data.response.id);
2612
+ assert.equal('string', data.response.fullname);
2613
+ assert.equal('string', data.response.email);
2614
+ } else {
2615
+ runCommonAsserts(data, error);
2616
+ }
2617
+ saveMockData('SubscriberAPI', 'statisticsForSpecificSubscriber', 'default', data);
2618
+ done();
2619
+ } catch (err) {
2620
+ log.error(`Test Failure: ${err}`);
2621
+ done(err);
2622
+ }
2623
+ });
2624
+ } catch (error) {
2625
+ log.error(`Adapter Exception: ${error}`);
2626
+ done(error);
2627
+ }
2628
+ } else {
2629
+ log.error('statisticsForSpecificSubscriber task is false, skipping test');
2630
+ skipCount += 1;
2631
+ done();
2632
+ }// end if task
2633
+ }).timeout(attemptTimeout);
2634
+ });
2635
+
2636
+ const subscriberAPISubscriberAttributeBodyParam = {};
2637
+ describe('#subscriberAttribute - errors', () => {
2638
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2639
+ if (pronghorn.methodsByName.subscriberAttribute.task) {
2640
+ try {
2641
+ a.subscriberAttribute(subscriberAPIPersonId, subscriberAPISubscriberAttributeBodyParam, (data, error) => {
2642
+ try {
2643
+ if (stub) {
2644
+ const displayE = 'Error 400 received on request';
2645
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2646
+ } else {
2647
+ runCommonAsserts(data, error);
2648
+ }
2649
+ saveMockData('SubscriberAPI', 'subscriberAttribute', 'default', data);
2650
+ done();
2651
+ } catch (err) {
2652
+ log.error(`Test Failure: ${err}`);
2653
+ done(err);
2654
+ }
2655
+ });
2656
+ } catch (error) {
2657
+ log.error(`Adapter Exception: ${error}`);
2658
+ done(error);
2659
+ }
2660
+ } else {
2661
+ log.error('subscriberAttribute task is false, skipping test');
2662
+ skipCount += 1;
2663
+ done();
2664
+ }// end if task
2665
+ }).timeout(attemptTimeout);
2666
+ });
2667
+
2668
+ describe('#subscriberAttributeTree - errors', () => {
2669
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2670
+ if (pronghorn.methodsByName.subscriberAttributeTree.task) {
2671
+ try {
2672
+ a.subscriberAttributeTree(subscriberAPIPersonId, (data, error) => {
2673
+ try {
2674
+ if (stub) {
2675
+ const displayE = 'Error 400 received on request';
2676
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2677
+ } else {
2678
+ runCommonAsserts(data, error);
2679
+ }
2680
+ saveMockData('SubscriberAPI', 'subscriberAttributeTree', '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
+ } else {
2692
+ log.error('subscriberAttributeTree task is false, skipping test');
2693
+ skipCount += 1;
2694
+ done();
2695
+ }// end if task
2696
+ }).timeout(attemptTimeout);
2697
+ });
2698
+
2699
+ const subscriberAPICreateSubscriberLabelsBodyParam = [
2700
+ 'string'
2701
+ ];
2702
+ describe('#createSubscriberLabels - errors', () => {
2703
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2704
+ if (pronghorn.methodsByName.createSubscriberLabels.task) {
2705
+ try {
2706
+ a.createSubscriberLabels(subscriberAPIPersonId, subscriberAPICreateSubscriberLabelsBodyParam, (data, error) => {
2707
+ try {
2708
+ if (stub) {
2709
+ const displayE = 'Error 400 received on request';
2710
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2711
+ } else {
2712
+ runCommonAsserts(data, error);
2713
+ }
2714
+ saveMockData('SubscriberAPI', 'createSubscriberLabels', 'default', data);
2715
+ done();
2716
+ } catch (err) {
2717
+ log.error(`Test Failure: ${err}`);
2718
+ done(err);
2719
+ }
2720
+ });
2721
+ } catch (error) {
2722
+ log.error(`Adapter Exception: ${error}`);
2723
+ done(error);
2724
+ }
2725
+ } else {
2726
+ log.error('createSubscriberLabels task is false, skipping test');
2727
+ skipCount += 1;
2728
+ done();
2729
+ }// end if task
2730
+ }).timeout(attemptTimeout);
2731
+ });
2732
+
2733
+ describe('#subscriberLabelSet - errors', () => {
2734
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2735
+ if (pronghorn.methodsByName.subscriberLabelSet.task) {
2736
+ try {
2737
+ a.subscriberLabelSet(subscriberAPIPersonId, (data, error) => {
2738
+ try {
2739
+ if (stub) {
2740
+ const displayE = 'Error 400 received on request';
2741
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2742
+ } else {
2743
+ runCommonAsserts(data, error);
2744
+ }
2745
+ saveMockData('SubscriberAPI', 'subscriberLabelSet', 'default', data);
2746
+ done();
2747
+ } catch (err) {
2748
+ log.error(`Test Failure: ${err}`);
2749
+ done(err);
2750
+ }
2751
+ });
2752
+ } catch (error) {
2753
+ log.error(`Adapter Exception: ${error}`);
2754
+ done(error);
2755
+ }
2756
+ } else {
2757
+ log.error('subscriberLabelSet task is false, skipping test');
2758
+ skipCount += 1;
2759
+ done();
2760
+ }// end if task
2761
+ }).timeout(attemptTimeout);
2762
+ });
2763
+
2764
+ const subscriberAPICreateSubscriberManagementGroupBodyParam = {
2765
+ managedDevice: {
2766
+ id: 8
2767
+ },
2768
+ deviceSignature: {
2769
+ oui: 'string',
2770
+ serialNumber: 'string',
2771
+ provisioningCode: 'string',
2772
+ cpProvisioningId: 4
2773
+ }
2774
+ };
2775
+ describe('#createSubscriberManagementGroup - errors', () => {
2776
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2777
+ if (pronghorn.methodsByName.createSubscriberManagementGroup.task) {
2778
+ try {
2779
+ a.createSubscriberManagementGroup(subscriberAPIPersonId, subscriberAPICreateSubscriberManagementGroupBodyParam, (data, error) => {
2780
+ try {
2781
+ if (stub) {
2782
+ const displayE = 'Error 400 received on request';
2783
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2784
+ } else {
2785
+ runCommonAsserts(data, error);
2786
+ }
2787
+ saveMockData('SubscriberAPI', 'createSubscriberManagementGroup', 'default', data);
2788
+ done();
2789
+ } catch (err) {
2790
+ log.error(`Test Failure: ${err}`);
2791
+ done(err);
2792
+ }
2793
+ });
2794
+ } catch (error) {
2795
+ log.error(`Adapter Exception: ${error}`);
2796
+ done(error);
2797
+ }
2798
+ } else {
2799
+ log.error('createSubscriberManagementGroup task is false, skipping test');
2800
+ skipCount += 1;
2801
+ done();
2802
+ }// end if task
2803
+ }).timeout(attemptTimeout);
2804
+ });
2805
+
2806
+ describe('#subscriberManagementGroups - errors', () => {
2807
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2808
+ if (pronghorn.methodsByName.subscriberManagementGroups.task) {
2809
+ try {
2810
+ a.subscriberManagementGroups(subscriberAPIPersonId, null, null, (data, error) => {
2811
+ try {
2812
+ if (stub) {
2813
+ const displayE = 'Error 400 received on request';
2814
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2815
+ } else {
2816
+ runCommonAsserts(data, error);
2817
+ }
2818
+ saveMockData('SubscriberAPI', 'subscriberManagementGroups', 'default', data);
2819
+ done();
2820
+ } catch (err) {
2821
+ log.error(`Test Failure: ${err}`);
2822
+ done(err);
2823
+ }
2824
+ });
2825
+ } catch (error) {
2826
+ log.error(`Adapter Exception: ${error}`);
2827
+ done(error);
2828
+ }
2829
+ } else {
2830
+ log.error('subscriberManagementGroups task is false, skipping test');
2831
+ skipCount += 1;
2832
+ done();
2833
+ }// end if task
2834
+ }).timeout(attemptTimeout);
2835
+ });
2836
+
2837
+ describe('#subscriberManagementGroupDetails - errors', () => {
2838
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2839
+ if (pronghorn.methodsByName.subscriberManagementGroupDetails.task) {
2840
+ try {
2841
+ a.subscriberManagementGroupDetails(subscriberAPIPersonId, subscriberAPIManagementGroupId, (data, error) => {
2842
+ try {
2843
+ if (stub) {
2844
+ const displayE = 'Error 400 received on request';
2845
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2846
+ } else {
2847
+ runCommonAsserts(data, error);
2848
+ }
2849
+ saveMockData('SubscriberAPI', 'subscriberManagementGroupDetails', 'default', data);
2850
+ done();
2851
+ } catch (err) {
2852
+ log.error(`Test Failure: ${err}`);
2853
+ done(err);
2854
+ }
2855
+ });
2856
+ } catch (error) {
2857
+ log.error(`Adapter Exception: ${error}`);
2858
+ done(error);
2859
+ }
2860
+ } else {
2861
+ log.error('subscriberManagementGroupDetails task is false, skipping test');
2862
+ skipCount += 1;
2863
+ done();
2864
+ }// end if task
2865
+ }).timeout(attemptTimeout);
2866
+ });
2867
+
2868
+ describe('#managementGroupDeviceSignature - errors', () => {
2869
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2870
+ if (pronghorn.methodsByName.managementGroupDeviceSignature.task) {
2871
+ try {
2872
+ a.managementGroupDeviceSignature(subscriberAPIPersonId, subscriberAPIManagementGroupId, (data, error) => {
2873
+ try {
2874
+ if (stub) {
2875
+ const displayE = 'Error 400 received on request';
2876
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2877
+ } else {
2878
+ runCommonAsserts(data, error);
2879
+ }
2880
+ saveMockData('SubscriberAPI', 'managementGroupDeviceSignature', 'default', data);
2881
+ done();
2882
+ } catch (err) {
2883
+ log.error(`Test Failure: ${err}`);
2884
+ done(err);
2885
+ }
2886
+ });
2887
+ } catch (error) {
2888
+ log.error(`Adapter Exception: ${error}`);
2889
+ done(error);
2890
+ }
2891
+ } else {
2892
+ log.error('managementGroupDeviceSignature task is false, skipping test');
2893
+ skipCount += 1;
2894
+ done();
2895
+ }// end if task
2896
+ }).timeout(attemptTimeout);
2897
+ });
2898
+
2899
+ describe('#serviceSubscriptionDetails - errors', () => {
2900
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2901
+ if (pronghorn.methodsByName.serviceSubscriptionDetails.task) {
2902
+ try {
2903
+ a.serviceSubscriptionDetails(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIPackageName, (data, error) => {
2904
+ try {
2905
+ if (stub) {
2906
+ const displayE = 'Error 400 received on request';
2907
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2908
+ } else {
2909
+ runCommonAsserts(data, error);
2910
+ }
2911
+ saveMockData('SubscriberAPI', 'serviceSubscriptionDetails', 'default', data);
2912
+ done();
2913
+ } catch (err) {
2914
+ log.error(`Test Failure: ${err}`);
2915
+ done(err);
2916
+ }
2917
+ });
2918
+ } catch (error) {
2919
+ log.error(`Adapter Exception: ${error}`);
2920
+ done(error);
2921
+ }
2922
+ } else {
2923
+ log.error('serviceSubscriptionDetails task is false, skipping test');
2924
+ skipCount += 1;
2925
+ done();
2926
+ }// end if task
2927
+ }).timeout(attemptTimeout);
2928
+ });
2929
+
2930
+ const subscriberAPIAddSubscriptionToManagementGroupBodyParam = {
2931
+ status: 'DISABLING',
2932
+ package: {
2933
+ id: 5,
2934
+ name: 'string'
2935
+ }
2936
+ };
2937
+ describe('#addSubscriptionToManagementGroup - errors', () => {
2938
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2939
+ if (pronghorn.methodsByName.addSubscriptionToManagementGroup.task) {
2940
+ try {
2941
+ a.addSubscriptionToManagementGroup(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIAddSubscriptionToManagementGroupBodyParam, (data, error) => {
2942
+ try {
2943
+ if (stub) {
2944
+ const displayE = 'Error 400 received on request';
2945
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2946
+ } else {
2947
+ runCommonAsserts(data, error);
2948
+ }
2949
+ saveMockData('SubscriberAPI', 'addSubscriptionToManagementGroup', 'default', data);
2950
+ done();
2951
+ } catch (err) {
2952
+ log.error(`Test Failure: ${err}`);
2953
+ done(err);
2954
+ }
2955
+ });
2956
+ } catch (error) {
2957
+ log.error(`Adapter Exception: ${error}`);
2958
+ done(error);
2959
+ }
2960
+ } else {
2961
+ log.error('addSubscriptionToManagementGroup task is false, skipping test');
2962
+ skipCount += 1;
2963
+ done();
2964
+ }// end if task
2965
+ }).timeout(attemptTimeout);
2966
+ });
2967
+
2968
+ describe('#subscriptionsForManagementGroup - errors', () => {
2969
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2970
+ if (pronghorn.methodsByName.subscriptionsForManagementGroup.task) {
2971
+ try {
2972
+ a.subscriptionsForManagementGroup(subscriberAPIPersonId, subscriberAPIManagementGroupId, (data, error) => {
2973
+ try {
2974
+ if (stub) {
2975
+ const displayE = 'Error 400 received on request';
2976
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
2977
+ } else {
2978
+ runCommonAsserts(data, error);
2979
+ }
2980
+ saveMockData('SubscriberAPI', 'subscriptionsForManagementGroup', 'default', data);
2981
+ done();
2982
+ } catch (err) {
2983
+ log.error(`Test Failure: ${err}`);
2984
+ done(err);
2985
+ }
2986
+ });
2987
+ } catch (error) {
2988
+ log.error(`Adapter Exception: ${error}`);
2989
+ done(error);
2990
+ }
2991
+ } else {
2992
+ log.error('subscriptionsForManagementGroup task is false, skipping test');
2993
+ skipCount += 1;
2994
+ done();
2995
+ }// end if task
2996
+ }).timeout(attemptTimeout);
2997
+ });
2998
+
2999
+ const subscriberAPIModifyACSUserListBodyParam = {
3000
+ login: 'string',
3001
+ fullname: 'string',
3002
+ email: 'string',
3003
+ password: 'string',
3004
+ domains: [
3005
+ 'string'
3006
+ ]
3007
+ };
3008
+ describe('#modifyACSUserList - errors', () => {
3009
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3010
+ if (pronghorn.methodsByName.modifyACSUserList.task) {
3011
+ try {
3012
+ a.modifyACSUserList(subscriberAPIModifyACSUserListBodyParam, (data, error) => {
3013
+ try {
3014
+ if (stub) {
3015
+ const displayE = 'Error 400 received on request';
3016
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3017
+ } else {
3018
+ runCommonAsserts(data, error);
3019
+ }
3020
+ saveMockData('SubscriberAPI', 'modifyACSUserList', 'default', data);
3021
+ done();
3022
+ } catch (err) {
3023
+ log.error(`Test Failure: ${err}`);
3024
+ done(err);
3025
+ }
3026
+ });
3027
+ } catch (error) {
3028
+ log.error(`Adapter Exception: ${error}`);
3029
+ done(error);
3030
+ }
3031
+ } else {
3032
+ log.error('modifyACSUserList task is false, skipping test');
3033
+ skipCount += 1;
3034
+ done();
3035
+ }// end if task
3036
+ }).timeout(attemptTimeout);
3037
+ });
3038
+
3039
+ describe('#aCSUserListGET - errors', () => {
3040
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3041
+ if (pronghorn.methodsByName.aCSUserListGET.task) {
3042
+ try {
3043
+ a.aCSUserListGET((data, error) => {
3044
+ try {
3045
+ if (stub) {
3046
+ const displayE = 'Error 400 received on request';
3047
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3048
+ } else {
3049
+ runCommonAsserts(data, error);
3050
+ }
3051
+ saveMockData('SubscriberAPI', 'aCSUserListGET', 'default', data);
3052
+ done();
3053
+ } catch (err) {
3054
+ log.error(`Test Failure: ${err}`);
3055
+ done(err);
3056
+ }
3057
+ });
3058
+ } catch (error) {
3059
+ log.error(`Adapter Exception: ${error}`);
3060
+ done(error);
3061
+ }
3062
+ } else {
3063
+ log.error('aCSUserListGET task is false, skipping test');
3064
+ skipCount += 1;
3065
+ done();
3066
+ }// end if task
3067
+ }).timeout(attemptTimeout);
3068
+ });
3069
+
3070
+ describe('#userDetails - errors', () => {
3071
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3072
+ if (pronghorn.methodsByName.userDetails.task) {
3073
+ try {
3074
+ a.userDetails(subscriberAPILogin, (data, error) => {
3075
+ try {
3076
+ if (stub) {
3077
+ const displayE = 'Error 400 received on request';
3078
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3079
+ } else {
3080
+ runCommonAsserts(data, error);
3081
+ }
3082
+ saveMockData('SubscriberAPI', 'userDetails', 'default', data);
3083
+ done();
3084
+ } catch (err) {
3085
+ log.error(`Test Failure: ${err}`);
3086
+ done(err);
3087
+ }
3088
+ });
3089
+ } catch (error) {
3090
+ log.error(`Adapter Exception: ${error}`);
3091
+ done(error);
3092
+ }
3093
+ } else {
3094
+ log.error('userDetails task is false, skipping test');
3095
+ skipCount += 1;
3096
+ done();
3097
+ }// end if task
3098
+ }).timeout(attemptTimeout);
3099
+ });
3100
+
3101
+ describe('#getUserLabels - errors', () => {
3102
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3103
+ if (pronghorn.methodsByName.getUserLabels.task) {
3104
+ try {
3105
+ a.getUserLabels(subscriberAPILogin, (data, error) => {
3106
+ try {
3107
+ if (stub) {
3108
+ const displayE = 'Error 400 received on request';
3109
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3110
+ } else {
3111
+ runCommonAsserts(data, error);
3112
+ }
3113
+ saveMockData('SubscriberAPI', 'getUserLabels', 'default', data);
3114
+ done();
3115
+ } catch (err) {
3116
+ log.error(`Test Failure: ${err}`);
3117
+ done(err);
3118
+ }
3119
+ });
3120
+ } catch (error) {
3121
+ log.error(`Adapter Exception: ${error}`);
3122
+ done(error);
3123
+ }
3124
+ } else {
3125
+ log.error('getUserLabels task is false, skipping test');
3126
+ skipCount += 1;
3127
+ done();
3128
+ }// end if task
3129
+ }).timeout(attemptTimeout);
3130
+ });
3131
+
3132
+ const subscriberAPICreateUserNotificationBodyParam = {
3133
+ id: 1,
3134
+ code: 'string',
3135
+ labels: [
3136
+ 'string'
3137
+ ]
3138
+ };
3139
+ describe('#createUserNotification - errors', () => {
3140
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3141
+ if (pronghorn.methodsByName.createUserNotification.task) {
3142
+ try {
3143
+ a.createUserNotification(subscriberAPILogin, subscriberAPICreateUserNotificationBodyParam, (data, error) => {
3144
+ try {
3145
+ if (stub) {
3146
+ const displayE = 'Error 400 received on request';
3147
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3148
+ } else {
3149
+ runCommonAsserts(data, error);
3150
+ }
3151
+ saveMockData('SubscriberAPI', 'createUserNotification', 'default', data);
3152
+ done();
3153
+ } catch (err) {
3154
+ log.error(`Test Failure: ${err}`);
3155
+ done(err);
3156
+ }
3157
+ });
3158
+ } catch (error) {
3159
+ log.error(`Adapter Exception: ${error}`);
3160
+ done(error);
3161
+ }
3162
+ } else {
3163
+ log.error('createUserNotification task is false, skipping test');
3164
+ skipCount += 1;
3165
+ done();
3166
+ }// end if task
3167
+ }).timeout(attemptTimeout);
3168
+ });
3169
+
3170
+ describe('#userNotificationsForPast10Minutes - errors', () => {
3171
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3172
+ if (pronghorn.methodsByName.userNotificationsForPast10Minutes.task) {
3173
+ try {
3174
+ a.userNotificationsForPast10Minutes(subscriberAPILogin, (data, error) => {
3175
+ try {
3176
+ if (stub) {
3177
+ const displayE = 'Error 400 received on request';
3178
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3179
+ } else {
3180
+ runCommonAsserts(data, error);
3181
+ }
3182
+ saveMockData('SubscriberAPI', 'userNotificationsForPast10Minutes', 'default', data);
3183
+ done();
3184
+ } catch (err) {
3185
+ log.error(`Test Failure: ${err}`);
3186
+ done(err);
3187
+ }
3188
+ });
3189
+ } catch (error) {
3190
+ log.error(`Adapter Exception: ${error}`);
3191
+ done(error);
3192
+ }
3193
+ } else {
3194
+ log.error('userNotificationsForPast10Minutes task is false, skipping test');
3195
+ skipCount += 1;
3196
+ done();
3197
+ }// end if task
3198
+ }).timeout(attemptTimeout);
3199
+ });
3200
+
3201
+ describe('#getUserRoles - errors', () => {
3202
+ it('should work if integrated or standalone with mockdata', (done) => {
3203
+ if (pronghorn.methodsByName.getUserRoles.task) {
3204
+ try {
3205
+ a.getUserRoles(subscriberAPILogin, (data, error) => {
3206
+ try {
3207
+ if (stub) {
3208
+ runCommonAsserts(data, error);
3209
+ assert.equal('admin', data.response[0]);
3210
+ assert.equal('admin', data.response[1]);
3211
+ } else {
3212
+ runCommonAsserts(data, error);
3213
+ }
3214
+ saveMockData('SubscriberAPI', 'getUserRoles', 'default', data);
3215
+ done();
3216
+ } catch (err) {
3217
+ log.error(`Test Failure: ${err}`);
3218
+ done(err);
3219
+ }
3220
+ });
3221
+ } catch (error) {
3222
+ log.error(`Adapter Exception: ${error}`);
3223
+ done(error);
3224
+ }
3225
+ } else {
3226
+ log.error('getUserRoles task is false, skipping test');
3227
+ skipCount += 1;
3228
+ done();
3229
+ }// end if task
3230
+ }).timeout(attemptTimeout);
3231
+ });
3232
+
3233
+ describe('#deleteDevice - errors', () => {
3234
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3235
+ if (pronghorn.methodsByName.deleteDevice.task) {
3236
+ try {
3237
+ a.deleteDevice(deviceAPIId, (data, error) => {
3238
+ try {
3239
+ if (stub) {
3240
+ const displayE = 'Error 400 received on request';
3241
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3242
+ } else {
3243
+ runCommonAsserts(data, error);
3244
+ }
3245
+ saveMockData('DeviceAPI', 'deleteDevice', '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
+ } else {
3257
+ log.error('deleteDevice task is false, skipping test');
3258
+ skipCount += 1;
3259
+ done();
3260
+ }// end if task
3261
+ }).timeout(attemptTimeout);
3262
+ });
3263
+
3264
+ describe('#removeDeviceType - errors', () => {
3265
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3266
+ if (pronghorn.methodsByName.removeDeviceType.task) {
3267
+ try {
3268
+ a.removeDeviceType(deviceAPIDeviceTypeId, (data, error) => {
3269
+ try {
3270
+ if (stub) {
3271
+ const displayE = 'Error 400 received on request';
3272
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3273
+ } else {
3274
+ runCommonAsserts(data, error);
3275
+ }
3276
+ saveMockData('DeviceAPI', 'removeDeviceType', 'default', data);
3277
+ done();
3278
+ } catch (err) {
3279
+ log.error(`Test Failure: ${err}`);
3280
+ done(err);
3281
+ }
3282
+ });
3283
+ } catch (error) {
3284
+ log.error(`Adapter Exception: ${error}`);
3285
+ done(error);
3286
+ }
3287
+ } else {
3288
+ log.error('removeDeviceType task is false, skipping test');
3289
+ skipCount += 1;
3290
+ done();
3291
+ }// end if task
3292
+ }).timeout(attemptTimeout);
3293
+ });
3294
+
3295
+ describe('#removeFirmwareDescription - errors', () => {
3296
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3297
+ if (pronghorn.methodsByName.removeFirmwareDescription.task) {
3298
+ try {
3299
+ a.removeFirmwareDescription(deviceAPIDeviceTypeId, deviceAPIFirmwareId, (data, error) => {
3300
+ try {
3301
+ if (stub) {
3302
+ const displayE = 'Error 400 received on request';
3303
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3304
+ } else {
3305
+ runCommonAsserts(data, error);
3306
+ }
3307
+ saveMockData('DeviceAPI', 'removeFirmwareDescription', 'default', data);
3308
+ done();
3309
+ } catch (err) {
3310
+ log.error(`Test Failure: ${err}`);
3311
+ done(err);
3312
+ }
3313
+ });
3314
+ } catch (error) {
3315
+ log.error(`Adapter Exception: ${error}`);
3316
+ done(error);
3317
+ }
3318
+ } else {
3319
+ log.error('removeFirmwareDescription task is false, skipping test');
3320
+ skipCount += 1;
3321
+ done();
3322
+ }// end if task
3323
+ }).timeout(attemptTimeout);
3324
+ });
3325
+
3326
+ describe('#queuedAction - errors', () => {
3327
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3328
+ if (pronghorn.methodsByName.queuedAction.task) {
3329
+ try {
3330
+ a.queuedAction(deviceAPIId, deviceAPIScriptRunId, (data, error) => {
3331
+ try {
3332
+ if (stub) {
3333
+ const displayE = 'Error 400 received on request';
3334
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3335
+ } else {
3336
+ runCommonAsserts(data, error);
3337
+ }
3338
+ saveMockData('DeviceAPI', 'queuedAction', 'default', data);
3339
+ done();
3340
+ } catch (err) {
3341
+ log.error(`Test Failure: ${err}`);
3342
+ done(err);
3343
+ }
3344
+ });
3345
+ } catch (error) {
3346
+ log.error(`Adapter Exception: ${error}`);
3347
+ done(error);
3348
+ }
3349
+ } else {
3350
+ log.error('queuedAction task is false, skipping test');
3351
+ skipCount += 1;
3352
+ done();
3353
+ }// end if task
3354
+ }).timeout(attemptTimeout);
3355
+ });
3356
+
3357
+ describe('#removeDeviceAttributes - errors', () => {
3358
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3359
+ if (pronghorn.methodsByName.removeDeviceAttributes.task) {
3360
+ try {
3361
+ a.removeDeviceAttributes(deviceAPIId, (data, error) => {
3362
+ try {
3363
+ if (stub) {
3364
+ const displayE = 'Error 400 received on request';
3365
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3366
+ } else {
3367
+ runCommonAsserts(data, error);
3368
+ }
3369
+ saveMockData('DeviceAPI', 'removeDeviceAttributes', 'default', data);
3370
+ done();
3371
+ } catch (err) {
3372
+ log.error(`Test Failure: ${err}`);
3373
+ done(err);
3374
+ }
3375
+ });
3376
+ } catch (error) {
3377
+ log.error(`Adapter Exception: ${error}`);
3378
+ done(error);
3379
+ }
3380
+ } else {
3381
+ log.error('removeDeviceAttributes task is false, skipping test');
3382
+ skipCount += 1;
3383
+ done();
3384
+ }// end if task
3385
+ }).timeout(attemptTimeout);
3386
+ });
3387
+
3388
+ describe('#deleteSubscriberLoginSession - errors', () => {
3389
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3390
+ if (pronghorn.methodsByName.deleteSubscriberLoginSession.task) {
3391
+ try {
3392
+ a.deleteSubscriberLoginSession(subscriberAPITokenId, (data, error) => {
3393
+ try {
3394
+ if (stub) {
3395
+ const displayE = 'Error 400 received on request';
3396
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3397
+ } else {
3398
+ runCommonAsserts(data, error);
3399
+ }
3400
+ saveMockData('SubscriberAPI', 'deleteSubscriberLoginSession', 'default', data);
3401
+ done();
3402
+ } catch (err) {
3403
+ log.error(`Test Failure: ${err}`);
3404
+ done(err);
3405
+ }
3406
+ });
3407
+ } catch (error) {
3408
+ log.error(`Adapter Exception: ${error}`);
3409
+ done(error);
3410
+ }
3411
+ } else {
3412
+ log.error('deleteSubscriberLoginSession task is false, skipping test');
3413
+ skipCount += 1;
3414
+ done();
3415
+ }// end if task
3416
+ }).timeout(attemptTimeout);
3417
+ });
3418
+
3419
+ describe('#deleteSubscriber - errors', () => {
3420
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3421
+ if (pronghorn.methodsByName.deleteSubscriber.task) {
3422
+ try {
3423
+ a.deleteSubscriber(subscriberAPIPersonId, (data, error) => {
3424
+ try {
3425
+ if (stub) {
3426
+ const displayE = 'Error 400 received on request';
3427
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3428
+ } else {
3429
+ runCommonAsserts(data, error);
3430
+ }
3431
+ saveMockData('SubscriberAPI', 'deleteSubscriber', 'default', data);
3432
+ done();
3433
+ } catch (err) {
3434
+ log.error(`Test Failure: ${err}`);
3435
+ done(err);
3436
+ }
3437
+ });
3438
+ } catch (error) {
3439
+ log.error(`Adapter Exception: ${error}`);
3440
+ done(error);
3441
+ }
3442
+ } else {
3443
+ log.error('deleteSubscriber task is false, skipping test');
3444
+ skipCount += 1;
3445
+ done();
3446
+ }// end if task
3447
+ }).timeout(attemptTimeout);
3448
+ });
3449
+
3450
+ const subscriberAPIName = 'fakedata';
3451
+ describe('#deleteSubscriberAttributes - errors', () => {
3452
+ it('should work if integrated or standalone with mockdata', (done) => {
3453
+ if (pronghorn.methodsByName.deleteSubscriberAttributes.task) {
3454
+ try {
3455
+ a.deleteSubscriberAttributes(subscriberAPIPersonId, subscriberAPIName, (data, error) => {
3456
+ try {
3457
+ if (stub) {
3458
+ runCommonAsserts(data, error);
3459
+ assert.equal('success', data.response);
3460
+ } else {
3461
+ runCommonAsserts(data, error);
3462
+ }
3463
+ saveMockData('SubscriberAPI', 'deleteSubscriberAttributes', 'default', data);
3464
+ done();
3465
+ } catch (err) {
3466
+ log.error(`Test Failure: ${err}`);
3467
+ done(err);
3468
+ }
3469
+ });
3470
+ } catch (error) {
3471
+ log.error(`Adapter Exception: ${error}`);
3472
+ done(error);
3473
+ }
3474
+ } else {
3475
+ log.error('deleteSubscriberAttributes task is false, skipping test');
3476
+ skipCount += 1;
3477
+ done();
3478
+ }// end if task
3479
+ }).timeout(attemptTimeout);
3480
+ });
3481
+
3482
+ describe('#subscriberManagementGroup - errors', () => {
3483
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3484
+ if (pronghorn.methodsByName.subscriberManagementGroup.task) {
3485
+ try {
3486
+ a.subscriberManagementGroup(subscriberAPIPersonId, subscriberAPIManagementGroupId, (data, error) => {
3487
+ try {
3488
+ if (stub) {
3489
+ const displayE = 'Error 400 received on request';
3490
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3491
+ } else {
3492
+ runCommonAsserts(data, error);
3493
+ }
3494
+ saveMockData('SubscriberAPI', 'subscriberManagementGroup', 'default', data);
3495
+ done();
3496
+ } catch (err) {
3497
+ log.error(`Test Failure: ${err}`);
3498
+ done(err);
3499
+ }
3500
+ });
3501
+ } catch (error) {
3502
+ log.error(`Adapter Exception: ${error}`);
3503
+ done(error);
3504
+ }
3505
+ } else {
3506
+ log.error('subscriberManagementGroup task is false, skipping test');
3507
+ skipCount += 1;
3508
+ done();
3509
+ }// end if task
3510
+ }).timeout(attemptTimeout);
3511
+ });
3512
+
3513
+ describe('#subscriptionPackage - errors', () => {
3514
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3515
+ if (pronghorn.methodsByName.subscriptionPackage.task) {
3516
+ try {
3517
+ a.subscriptionPackage(subscriberAPIPersonId, subscriberAPIManagementGroupId, subscriberAPIPackageName, (data, error) => {
3518
+ try {
3519
+ if (stub) {
3520
+ const displayE = 'Error 400 received on request';
3521
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3522
+ } else {
3523
+ runCommonAsserts(data, error);
3524
+ }
3525
+ saveMockData('SubscriberAPI', 'subscriptionPackage', 'default', data);
3526
+ done();
3527
+ } catch (err) {
3528
+ log.error(`Test Failure: ${err}`);
3529
+ done(err);
3530
+ }
3531
+ });
3532
+ } catch (error) {
3533
+ log.error(`Adapter Exception: ${error}`);
3534
+ done(error);
3535
+ }
3536
+ } else {
3537
+ log.error('subscriptionPackage task is false, skipping test');
3538
+ skipCount += 1;
3539
+ done();
3540
+ }// end if task
3541
+ }).timeout(attemptTimeout);
3542
+ });
3543
+
3544
+ describe('#deleteUser - errors', () => {
3545
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3546
+ if (pronghorn.methodsByName.deleteUser.task) {
3547
+ try {
3548
+ a.deleteUser(subscriberAPILogin, (data, error) => {
3549
+ try {
3550
+ if (stub) {
3551
+ const displayE = 'Error 400 received on request';
3552
+ runErrorAsserts(data, error, 'AD.500', 'Test-adtran_mosaic_devicemanager-connectorRest-handleEndResponse', displayE);
3553
+ } else {
3554
+ runCommonAsserts(data, error);
3555
+ }
3556
+ saveMockData('SubscriberAPI', 'deleteUser', 'default', data);
3557
+ done();
3558
+ } catch (err) {
3559
+ log.error(`Test Failure: ${err}`);
3560
+ done(err);
3561
+ }
3562
+ });
3563
+ } catch (error) {
3564
+ log.error(`Adapter Exception: ${error}`);
3565
+ done(error);
3566
+ }
3567
+ } else {
3568
+ log.error('deleteUser task is false, skipping test');
3569
+ skipCount += 1;
3570
+ done();
3571
+ }// end if task
3572
+ }).timeout(attemptTimeout);
3573
+ });
3574
+
3575
+ describe('#Skipped test count', () => {
3576
+ it('count skipped tests', (done) => {
3577
+ console.log(`skipped ${skipCount} tests because \x1b[33mtask: false\x1b[0m`);
3578
+ done();
3579
+ });
3580
+ });
3581
+ });
3582
+ });