@itentialopensource/adapter-thingspace 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.
- package/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.gitlab/.gitkeep +0 -0
- package/.gitlab/issue_templates/.gitkeep +0 -0
- package/.gitlab/issue_templates/Default.md +17 -0
- package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
- package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
- package/.jshintrc +0 -0
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +422 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +172 -0
- package/ENHANCE.md +69 -0
- package/LICENSE +201 -0
- package/PROPERTIES.md +641 -0
- package/README.md +337 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +5026 -0
- package/adapterBase.js +1787 -0
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +69 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq_MFA_Step_1.json +19 -0
- package/entities/.system/schemaTokenReq_MFA_Step_2.json +32 -0
- package/entities/.system/schemaTokenResp_MFA_Step_1.json +27 -0
- package/entities/.system/schemaTokenResp_MFA_Step_2.json +27 -0
- package/entities/Accounts/action.json +67 -0
- package/entities/Accounts/schema.json +21 -0
- package/entities/Callbacks/action.json +65 -0
- package/entities/Callbacks/mockdatafiles/listCallbacksUsingGET-default.json +23 -0
- package/entities/Callbacks/schema.json +21 -0
- package/entities/Devices/action.json +464 -0
- package/entities/Devices/mockdatafiles/addUsingPOST-default.json +23 -0
- package/entities/Devices/mockdatafiles/connectionListHistoryUsingPOST-default.json +868 -0
- package/entities/Devices/mockdatafiles/deleteUsingPOST-default.json +32 -0
- package/entities/Devices/mockdatafiles/provisioningHistoryListUsingPOST-default.json +427 -0
- package/entities/Devices/mockdatafiles/usageListUsingPOST-default.json +369 -0
- package/entities/Devices/schema.json +41 -0
- package/entities/Groups/action.json +106 -0
- package/entities/Groups/mockdatafiles/getListUsingGET-default.json +68 -0
- package/entities/Groups/schema.json +23 -0
- package/entities/Plans/action.json +25 -0
- package/entities/Plans/mockdatafiles/getServicePlanListUsingGET-default.json +98 -0
- package/entities/Plans/schema.json +19 -0
- package/entities/Requests/action.json +25 -0
- package/entities/Requests/schema.json +19 -0
- package/entities/Session/action.json +64 -0
- package/entities/Session/schema.json +21 -0
- package/entities/Sms/action.json +65 -0
- package/entities/Sms/schema.json +21 -0
- package/error.json +190 -0
- package/package.json +85 -0
- package/pronghorn.json +3761 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1249 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/creationReport.json +485 -0
- package/report/m2m-all.json +4020 -0
- package/sampleProperties.json +195 -0
- package/test/integration/adapterTestBasicGet.js +83 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +1957 -0
- package/test/unit/adapterBaseTestUnit.js +950 -0
- package/test/unit/adapterTestUnit.js +2631 -0
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +178 -0
- package/utils/findPath.js +74 -0
- package/utils/methodDocumentor.js +225 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +32 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +246 -0
- package/utils/tbUtils.js +490 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +195 -0
- package/workflows/README.md +3 -0
|
@@ -0,0 +1,1957 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
// Set globals
|
|
4
|
+
/* global describe it log pronghornProps */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint no-underscore-dangle: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
8
|
+
|
|
9
|
+
// include required items for testing & logging
|
|
10
|
+
const assert = require('assert');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const mocha = require('mocha');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const winston = require('winston');
|
|
15
|
+
const { expect } = require('chai');
|
|
16
|
+
const { use } = require('chai');
|
|
17
|
+
const td = require('testdouble');
|
|
18
|
+
const util = require('util');
|
|
19
|
+
|
|
20
|
+
const anything = td.matchers.anything();
|
|
21
|
+
|
|
22
|
+
// stub and attemptTimeout are used throughout the code so set them here
|
|
23
|
+
let logLevel = 'none';
|
|
24
|
+
const isRapidFail = false;
|
|
25
|
+
const isSaveMockData = false;
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
35
|
+
|
|
36
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
37
|
+
// always check these in with bogus data!!!
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
if (samProps.request.attempt_timeout < 30000) {
|
|
47
|
+
samProps.request.attempt_timeout = 30000;
|
|
48
|
+
}
|
|
49
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
50
|
+
const { stub } = samProps;
|
|
51
|
+
|
|
52
|
+
// these are the adapter properties. You generally should not need to alter
|
|
53
|
+
// any of these after they are initially set up
|
|
54
|
+
global.pronghornProps = {
|
|
55
|
+
pathProps: {
|
|
56
|
+
encrypted: false
|
|
57
|
+
},
|
|
58
|
+
adapterProps: {
|
|
59
|
+
adapters: [{
|
|
60
|
+
id: 'Test-thingspace',
|
|
61
|
+
type: 'Thingspace',
|
|
62
|
+
properties: samProps
|
|
63
|
+
}]
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
global.$HOME = `${__dirname}/../..`;
|
|
68
|
+
|
|
69
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
70
|
+
// this you may error on log.trace calls.
|
|
71
|
+
const myCustomLevels = {
|
|
72
|
+
levels: {
|
|
73
|
+
spam: 6,
|
|
74
|
+
trace: 5,
|
|
75
|
+
debug: 4,
|
|
76
|
+
info: 3,
|
|
77
|
+
warn: 2,
|
|
78
|
+
error: 1,
|
|
79
|
+
none: 0
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// need to see if there is a log level passed in
|
|
84
|
+
process.argv.forEach((val) => {
|
|
85
|
+
// is there a log level defined to be passed in?
|
|
86
|
+
if (val.indexOf('--LOG') === 0) {
|
|
87
|
+
// get the desired log level
|
|
88
|
+
const inputVal = val.split('=')[1];
|
|
89
|
+
|
|
90
|
+
// validate the log level is supported, if so set it
|
|
91
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
92
|
+
logLevel = inputVal;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// need to set global logging
|
|
98
|
+
global.log = winston.createLogger({
|
|
99
|
+
level: logLevel,
|
|
100
|
+
levels: myCustomLevels.levels,
|
|
101
|
+
transports: [
|
|
102
|
+
new winston.transports.Console()
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Runs the common asserts for test
|
|
108
|
+
*/
|
|
109
|
+
function runCommonAsserts(data, error) {
|
|
110
|
+
assert.equal(undefined, error);
|
|
111
|
+
assert.notEqual(undefined, data);
|
|
112
|
+
assert.notEqual(null, data);
|
|
113
|
+
assert.notEqual(undefined, data.response);
|
|
114
|
+
assert.notEqual(null, data.response);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Runs the error asserts for the test
|
|
119
|
+
*/
|
|
120
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
121
|
+
assert.equal(null, data);
|
|
122
|
+
assert.notEqual(undefined, error);
|
|
123
|
+
assert.notEqual(null, error);
|
|
124
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
125
|
+
assert.notEqual(null, error.IAPerror);
|
|
126
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
127
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
128
|
+
assert.equal(code, error.icode);
|
|
129
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
130
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @function saveMockData
|
|
135
|
+
* Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
|
|
136
|
+
* Note, this was built based on entity file structure for Adapter-Engine 1.6.x
|
|
137
|
+
* @param {string} entityName - Name of the entity saving mock data for
|
|
138
|
+
* @param {string} actionName - Name of the action saving mock data for
|
|
139
|
+
* @param {string} descriptor - Something to describe this test (used as a type)
|
|
140
|
+
* @param {string or object} responseData - The data to put in the mock file.
|
|
141
|
+
*/
|
|
142
|
+
function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
143
|
+
// do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
|
|
144
|
+
if (stub || !isSaveMockData) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// must have a response in order to store the response
|
|
149
|
+
if (responseData && responseData.response) {
|
|
150
|
+
let data = responseData.response;
|
|
151
|
+
|
|
152
|
+
// if there was a raw response that one is better as it is untranslated
|
|
153
|
+
if (responseData.raw) {
|
|
154
|
+
data = responseData.raw;
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
const temp = JSON.parse(data);
|
|
158
|
+
data = temp;
|
|
159
|
+
} catch (pex) {
|
|
160
|
+
// do not care if it did not parse as we will just use data
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const base = path.join(__dirname, `../../entities/${entityName}/`);
|
|
166
|
+
const mockdatafolder = 'mockdatafiles';
|
|
167
|
+
const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
|
|
168
|
+
|
|
169
|
+
if (!fs.existsSync(base + mockdatafolder)) {
|
|
170
|
+
fs.mkdirSync(base + mockdatafolder);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// write the data we retrieved
|
|
174
|
+
fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
|
|
175
|
+
if (errWritingMock) throw errWritingMock;
|
|
176
|
+
|
|
177
|
+
// update the action file to reflect the changes. Note: We're replacing the default object for now!
|
|
178
|
+
fs.readFile(`${base}action.json`, (errRead, content) => {
|
|
179
|
+
if (errRead) throw errRead;
|
|
180
|
+
|
|
181
|
+
// parse the action file into JSON
|
|
182
|
+
const parsedJson = JSON.parse(content);
|
|
183
|
+
|
|
184
|
+
// The object update we'll write in.
|
|
185
|
+
const responseObj = {
|
|
186
|
+
type: descriptor,
|
|
187
|
+
key: '',
|
|
188
|
+
mockFile: filename
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// get the object for method we're trying to change.
|
|
192
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
193
|
+
|
|
194
|
+
// if the method was not found - should never happen but...
|
|
195
|
+
if (!currentMethodAction) {
|
|
196
|
+
throw Error('Can\'t find an action for this method in the provided entity.');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
200
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
201
|
+
|
|
202
|
+
// Add the action responseObj back into the array of response objects.
|
|
203
|
+
if (!actionResponseObj) {
|
|
204
|
+
// if there is a default response object, we want to get the key.
|
|
205
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
206
|
+
|
|
207
|
+
// save the default key into the new response object
|
|
208
|
+
if (defaultResponseObj) {
|
|
209
|
+
responseObj.key = defaultResponseObj.key;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// save the new response object
|
|
213
|
+
currentMethodAction.responseObjects = [responseObj];
|
|
214
|
+
} else {
|
|
215
|
+
// update the location of the mock data file
|
|
216
|
+
actionResponseObj.mockFile = responseObj.mockFile;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Save results
|
|
220
|
+
fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
|
|
221
|
+
if (err) throw err;
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
} catch (e) {
|
|
226
|
+
log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// no response to save
|
|
232
|
+
log.debug(`No data passed to save into mockdata for ${actionName}`);
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// require the adapter that we are going to be using
|
|
237
|
+
const Thingspace = require('../../adapter');
|
|
238
|
+
|
|
239
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
240
|
+
describe('[integration] Thingspace Adapter Test', () => {
|
|
241
|
+
describe('Thingspace Class Tests', () => {
|
|
242
|
+
const a = new Thingspace(
|
|
243
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
244
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
if (isRapidFail) {
|
|
248
|
+
const state = {};
|
|
249
|
+
state.passed = true;
|
|
250
|
+
|
|
251
|
+
mocha.afterEach(function x() {
|
|
252
|
+
state.passed = state.passed
|
|
253
|
+
&& (this.currentTest.state === 'passed');
|
|
254
|
+
});
|
|
255
|
+
mocha.beforeEach(function x() {
|
|
256
|
+
if (!state.passed) {
|
|
257
|
+
return this.currentTest.skip();
|
|
258
|
+
}
|
|
259
|
+
return true;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
describe('#class instance created', () => {
|
|
264
|
+
it('should be a class with properties', (done) => {
|
|
265
|
+
try {
|
|
266
|
+
assert.notEqual(null, a);
|
|
267
|
+
assert.notEqual(undefined, a);
|
|
268
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
269
|
+
assert.equal(checkId, a.id);
|
|
270
|
+
assert.notEqual(null, a.allProps);
|
|
271
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
272
|
+
assert.equal(check, a.healthcheckType);
|
|
273
|
+
done();
|
|
274
|
+
} catch (error) {
|
|
275
|
+
log.error(`Test Failure: ${error}`);
|
|
276
|
+
done(error);
|
|
277
|
+
}
|
|
278
|
+
}).timeout(attemptTimeout);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
describe('#connect', () => {
|
|
282
|
+
it('should get connected - no healthcheck', (done) => {
|
|
283
|
+
try {
|
|
284
|
+
a.healthcheckType = 'none';
|
|
285
|
+
a.connect();
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
assert.equal(true, a.alive);
|
|
289
|
+
done();
|
|
290
|
+
} catch (error) {
|
|
291
|
+
log.error(`Test Failure: ${error}`);
|
|
292
|
+
done(error);
|
|
293
|
+
}
|
|
294
|
+
} catch (error) {
|
|
295
|
+
log.error(`Adapter Exception: ${error}`);
|
|
296
|
+
done(error);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
it('should get connected - startup healthcheck', (done) => {
|
|
300
|
+
try {
|
|
301
|
+
a.healthcheckType = 'startup';
|
|
302
|
+
a.connect();
|
|
303
|
+
|
|
304
|
+
try {
|
|
305
|
+
assert.equal(true, a.alive);
|
|
306
|
+
done();
|
|
307
|
+
} catch (error) {
|
|
308
|
+
log.error(`Test Failure: ${error}`);
|
|
309
|
+
done(error);
|
|
310
|
+
}
|
|
311
|
+
} catch (error) {
|
|
312
|
+
log.error(`Adapter Exception: ${error}`);
|
|
313
|
+
done(error);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
describe('#healthCheck', () => {
|
|
319
|
+
it('should be healthy', (done) => {
|
|
320
|
+
try {
|
|
321
|
+
a.healthCheck(null, (data) => {
|
|
322
|
+
try {
|
|
323
|
+
assert.equal(true, a.healthy);
|
|
324
|
+
saveMockData('system', 'healthcheck', 'default', data);
|
|
325
|
+
done();
|
|
326
|
+
} catch (err) {
|
|
327
|
+
log.error(`Test Failure: ${err}`);
|
|
328
|
+
done(err);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
} catch (error) {
|
|
332
|
+
log.error(`Adapter Exception: ${error}`);
|
|
333
|
+
done(error);
|
|
334
|
+
}
|
|
335
|
+
}).timeout(attemptTimeout);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
/*
|
|
339
|
+
-----------------------------------------------------------------------
|
|
340
|
+
-----------------------------------------------------------------------
|
|
341
|
+
*** All code above this comment will be replaced during a migration ***
|
|
342
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
343
|
+
-----------------------------------------------------------------------
|
|
344
|
+
-----------------------------------------------------------------------
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
const accountsAname = 'fakedata';
|
|
348
|
+
describe('#getAccountUsingGET - errors', () => {
|
|
349
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
350
|
+
try {
|
|
351
|
+
a.getAccountUsingGET(accountsAname, (data, error) => {
|
|
352
|
+
try {
|
|
353
|
+
if (stub) {
|
|
354
|
+
const displayE = 'Error 400 received on request';
|
|
355
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
356
|
+
} else {
|
|
357
|
+
runCommonAsserts(data, error);
|
|
358
|
+
}
|
|
359
|
+
saveMockData('Accounts', 'getAccountUsingGET', 'default', data);
|
|
360
|
+
done();
|
|
361
|
+
} catch (err) {
|
|
362
|
+
log.error(`Test Failure: ${err}`);
|
|
363
|
+
done(err);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
} catch (error) {
|
|
367
|
+
log.error(`Adapter Exception: ${error}`);
|
|
368
|
+
done(error);
|
|
369
|
+
}
|
|
370
|
+
}).timeout(attemptTimeout);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
describe('#getServicesAndStatesUsingGET - errors', () => {
|
|
374
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
375
|
+
try {
|
|
376
|
+
a.getServicesAndStatesUsingGET(accountsAname, (data, error) => {
|
|
377
|
+
try {
|
|
378
|
+
if (stub) {
|
|
379
|
+
const displayE = 'Error 400 received on request';
|
|
380
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
381
|
+
} else {
|
|
382
|
+
runCommonAsserts(data, error);
|
|
383
|
+
}
|
|
384
|
+
saveMockData('Accounts', 'getServicesAndStatesUsingGET', 'default', data);
|
|
385
|
+
done();
|
|
386
|
+
} catch (err) {
|
|
387
|
+
log.error(`Test Failure: ${err}`);
|
|
388
|
+
done(err);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
} catch (error) {
|
|
392
|
+
log.error(`Adapter Exception: ${error}`);
|
|
393
|
+
done(error);
|
|
394
|
+
}
|
|
395
|
+
}).timeout(attemptTimeout);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
describe('#getListUsingGET1 - errors', () => {
|
|
399
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
400
|
+
try {
|
|
401
|
+
a.getListUsingGET1(accountsAname, null, (data, error) => {
|
|
402
|
+
try {
|
|
403
|
+
if (stub) {
|
|
404
|
+
const displayE = 'Error 400 received on request';
|
|
405
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
406
|
+
} else {
|
|
407
|
+
runCommonAsserts(data, error);
|
|
408
|
+
}
|
|
409
|
+
saveMockData('Accounts', 'getListUsingGET1', 'default', data);
|
|
410
|
+
done();
|
|
411
|
+
} catch (err) {
|
|
412
|
+
log.error(`Test Failure: ${err}`);
|
|
413
|
+
done(err);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
} catch (error) {
|
|
417
|
+
log.error(`Adapter Exception: ${error}`);
|
|
418
|
+
done(error);
|
|
419
|
+
}
|
|
420
|
+
}).timeout(attemptTimeout);
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
const requestsAname = 'fakedata';
|
|
424
|
+
const requestsRequestId = 'fakedata';
|
|
425
|
+
describe('#getRequestStatusUsingGET - errors', () => {
|
|
426
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
427
|
+
try {
|
|
428
|
+
a.getRequestStatusUsingGET(requestsAname, requestsRequestId, (data, error) => {
|
|
429
|
+
try {
|
|
430
|
+
if (stub) {
|
|
431
|
+
const displayE = 'Error 400 received on request';
|
|
432
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
433
|
+
} else {
|
|
434
|
+
runCommonAsserts(data, error);
|
|
435
|
+
}
|
|
436
|
+
saveMockData('Requests', 'getRequestStatusUsingGET', 'default', data);
|
|
437
|
+
done();
|
|
438
|
+
} catch (err) {
|
|
439
|
+
log.error(`Test Failure: ${err}`);
|
|
440
|
+
done(err);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
} catch (error) {
|
|
444
|
+
log.error(`Adapter Exception: ${error}`);
|
|
445
|
+
done(error);
|
|
446
|
+
}
|
|
447
|
+
}).timeout(attemptTimeout);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
const callbacksAname = 'fakedata';
|
|
451
|
+
const callbacksRegisterCallbackUsingPOSTBodyParam = {
|
|
452
|
+
name: 'string',
|
|
453
|
+
url: 'string',
|
|
454
|
+
username: 'string',
|
|
455
|
+
password: 'string'
|
|
456
|
+
};
|
|
457
|
+
describe('#registerCallbackUsingPOST - errors', () => {
|
|
458
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
459
|
+
try {
|
|
460
|
+
a.registerCallbackUsingPOST(callbacksAname, callbacksRegisterCallbackUsingPOSTBodyParam, (data, error) => {
|
|
461
|
+
try {
|
|
462
|
+
if (stub) {
|
|
463
|
+
const displayE = 'Error 400 received on request';
|
|
464
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
465
|
+
} else {
|
|
466
|
+
runCommonAsserts(data, error);
|
|
467
|
+
}
|
|
468
|
+
saveMockData('Callbacks', 'registerCallbackUsingPOST', 'default', data);
|
|
469
|
+
done();
|
|
470
|
+
} catch (err) {
|
|
471
|
+
log.error(`Test Failure: ${err}`);
|
|
472
|
+
done(err);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
} catch (error) {
|
|
476
|
+
log.error(`Adapter Exception: ${error}`);
|
|
477
|
+
done(error);
|
|
478
|
+
}
|
|
479
|
+
}).timeout(attemptTimeout);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
describe('#listCallbacksUsingGET - errors', () => {
|
|
483
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
484
|
+
try {
|
|
485
|
+
a.listCallbacksUsingGET(callbacksAname, (data, error) => {
|
|
486
|
+
try {
|
|
487
|
+
if (stub) {
|
|
488
|
+
runCommonAsserts(data, error);
|
|
489
|
+
assert.equal('object', typeof data.response[0]);
|
|
490
|
+
assert.equal('object', typeof data.response[1]);
|
|
491
|
+
assert.equal('object', typeof data.response[2]);
|
|
492
|
+
} else {
|
|
493
|
+
runCommonAsserts(data, error);
|
|
494
|
+
}
|
|
495
|
+
saveMockData('Callbacks', 'listCallbacksUsingGET', 'default', data);
|
|
496
|
+
done();
|
|
497
|
+
} catch (err) {
|
|
498
|
+
log.error(`Test Failure: ${err}`);
|
|
499
|
+
done(err);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
} catch (error) {
|
|
503
|
+
log.error(`Adapter Exception: ${error}`);
|
|
504
|
+
done(error);
|
|
505
|
+
}
|
|
506
|
+
}).timeout(attemptTimeout);
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
const devicesActiveUsingPOSTBodyParam = {
|
|
510
|
+
accountName: 'string',
|
|
511
|
+
carrierIpPoolName: 'string',
|
|
512
|
+
carrierName: 'string',
|
|
513
|
+
costCenterCode: 'string',
|
|
514
|
+
customFields: [
|
|
515
|
+
{
|
|
516
|
+
key: 'string',
|
|
517
|
+
value: 'string'
|
|
518
|
+
}
|
|
519
|
+
],
|
|
520
|
+
devices: [
|
|
521
|
+
{
|
|
522
|
+
deviceIds: [
|
|
523
|
+
{
|
|
524
|
+
id: 'string',
|
|
525
|
+
kind: 'string'
|
|
526
|
+
}
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
groupName: 'string',
|
|
531
|
+
leadId: 'string',
|
|
532
|
+
mdnZipCode: 'string',
|
|
533
|
+
primaryPlaceOfUse: {
|
|
534
|
+
address: {
|
|
535
|
+
addressLine1: 'string',
|
|
536
|
+
addressLine2: 'string',
|
|
537
|
+
city: 'string',
|
|
538
|
+
state: 'string',
|
|
539
|
+
zip: 'string',
|
|
540
|
+
zip4: 'string',
|
|
541
|
+
country: 'string',
|
|
542
|
+
phone: 'string',
|
|
543
|
+
phoneType: 'string',
|
|
544
|
+
emailAddress: 'string'
|
|
545
|
+
},
|
|
546
|
+
customerName: {
|
|
547
|
+
title: 'string',
|
|
548
|
+
firstName: 'string',
|
|
549
|
+
middleName: 'string',
|
|
550
|
+
lastName: 'string',
|
|
551
|
+
suffix: 'string'
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
publicIpRestriction: 'string',
|
|
555
|
+
servicePlan: 'string',
|
|
556
|
+
skuNumber: 'string'
|
|
557
|
+
};
|
|
558
|
+
describe('#activeUsingPOST - errors', () => {
|
|
559
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
560
|
+
try {
|
|
561
|
+
a.activeUsingPOST(devicesActiveUsingPOSTBodyParam, (data, error) => {
|
|
562
|
+
try {
|
|
563
|
+
if (stub) {
|
|
564
|
+
const displayE = 'Error 400 received on request';
|
|
565
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
566
|
+
} else {
|
|
567
|
+
runCommonAsserts(data, error);
|
|
568
|
+
}
|
|
569
|
+
saveMockData('Devices', 'activeUsingPOST', 'default', data);
|
|
570
|
+
done();
|
|
571
|
+
} catch (err) {
|
|
572
|
+
log.error(`Test Failure: ${err}`);
|
|
573
|
+
done(err);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
} catch (error) {
|
|
577
|
+
log.error(`Adapter Exception: ${error}`);
|
|
578
|
+
done(error);
|
|
579
|
+
}
|
|
580
|
+
}).timeout(attemptTimeout);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
const devicesAddUsingPOSTBodyParam = {
|
|
584
|
+
accountName: 'string',
|
|
585
|
+
customFields: [
|
|
586
|
+
{
|
|
587
|
+
key: 'string',
|
|
588
|
+
value: 'string'
|
|
589
|
+
}
|
|
590
|
+
],
|
|
591
|
+
devicesToAdd: [
|
|
592
|
+
{
|
|
593
|
+
deviceIds: [
|
|
594
|
+
{
|
|
595
|
+
id: 'string',
|
|
596
|
+
kind: 'string'
|
|
597
|
+
}
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
groupName: 'string',
|
|
602
|
+
skuNumber: 'string',
|
|
603
|
+
state: 'string'
|
|
604
|
+
};
|
|
605
|
+
describe('#addUsingPOST - errors', () => {
|
|
606
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
607
|
+
try {
|
|
608
|
+
a.addUsingPOST(devicesAddUsingPOSTBodyParam, (data, error) => {
|
|
609
|
+
try {
|
|
610
|
+
if (stub) {
|
|
611
|
+
runCommonAsserts(data, error);
|
|
612
|
+
assert.equal('object', typeof data.response[0]);
|
|
613
|
+
} else {
|
|
614
|
+
runCommonAsserts(data, error);
|
|
615
|
+
}
|
|
616
|
+
saveMockData('Devices', 'addUsingPOST', 'default', data);
|
|
617
|
+
done();
|
|
618
|
+
} catch (err) {
|
|
619
|
+
log.error(`Test Failure: ${err}`);
|
|
620
|
+
done(err);
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
} catch (error) {
|
|
624
|
+
log.error(`Adapter Exception: ${error}`);
|
|
625
|
+
done(error);
|
|
626
|
+
}
|
|
627
|
+
}).timeout(attemptTimeout);
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
const devicesDeactiveUsingPOSTBodyParam = {
|
|
631
|
+
accountName: 'string',
|
|
632
|
+
customFields: [
|
|
633
|
+
{
|
|
634
|
+
key: 'string',
|
|
635
|
+
value: 'string'
|
|
636
|
+
}
|
|
637
|
+
],
|
|
638
|
+
devices: [
|
|
639
|
+
{
|
|
640
|
+
deviceIds: [
|
|
641
|
+
{
|
|
642
|
+
id: 'string',
|
|
643
|
+
kind: 'string'
|
|
644
|
+
}
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
],
|
|
648
|
+
etfWaiver: true,
|
|
649
|
+
groupName: 'string',
|
|
650
|
+
reasonCode: 'string',
|
|
651
|
+
servicePlan: 'string'
|
|
652
|
+
};
|
|
653
|
+
describe('#deactiveUsingPOST - errors', () => {
|
|
654
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
655
|
+
try {
|
|
656
|
+
a.deactiveUsingPOST(devicesDeactiveUsingPOSTBodyParam, (data, error) => {
|
|
657
|
+
try {
|
|
658
|
+
if (stub) {
|
|
659
|
+
const displayE = 'Error 400 received on request';
|
|
660
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
661
|
+
} else {
|
|
662
|
+
runCommonAsserts(data, error);
|
|
663
|
+
}
|
|
664
|
+
saveMockData('Devices', 'deactiveUsingPOST', 'default', data);
|
|
665
|
+
done();
|
|
666
|
+
} catch (err) {
|
|
667
|
+
log.error(`Test Failure: ${err}`);
|
|
668
|
+
done(err);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
} catch (error) {
|
|
672
|
+
log.error(`Adapter Exception: ${error}`);
|
|
673
|
+
done(error);
|
|
674
|
+
}
|
|
675
|
+
}).timeout(attemptTimeout);
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
const devicesDeleteUsingPOSTBodyParam = {
|
|
679
|
+
accountName: 'string',
|
|
680
|
+
devicesToDelete: [
|
|
681
|
+
{
|
|
682
|
+
deviceIds: [
|
|
683
|
+
{
|
|
684
|
+
id: 'string',
|
|
685
|
+
kind: 'string'
|
|
686
|
+
}
|
|
687
|
+
]
|
|
688
|
+
}
|
|
689
|
+
]
|
|
690
|
+
};
|
|
691
|
+
describe('#deleteUsingPOST - errors', () => {
|
|
692
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
693
|
+
try {
|
|
694
|
+
a.deleteUsingPOST(devicesDeleteUsingPOSTBodyParam, (data, error) => {
|
|
695
|
+
try {
|
|
696
|
+
if (stub) {
|
|
697
|
+
runCommonAsserts(data, error);
|
|
698
|
+
assert.equal('object', typeof data.response[0]);
|
|
699
|
+
} else {
|
|
700
|
+
runCommonAsserts(data, error);
|
|
701
|
+
}
|
|
702
|
+
saveMockData('Devices', 'deleteUsingPOST', 'default', data);
|
|
703
|
+
done();
|
|
704
|
+
} catch (err) {
|
|
705
|
+
log.error(`Test Failure: ${err}`);
|
|
706
|
+
done(err);
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
} catch (error) {
|
|
710
|
+
log.error(`Adapter Exception: ${error}`);
|
|
711
|
+
done(error);
|
|
712
|
+
}
|
|
713
|
+
}).timeout(attemptTimeout);
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
const devicesListUsingPOSTBodyParam = {
|
|
717
|
+
accountName: 'string',
|
|
718
|
+
deviceId: {
|
|
719
|
+
id: 'string',
|
|
720
|
+
kind: 'string'
|
|
721
|
+
},
|
|
722
|
+
filter: {
|
|
723
|
+
deviceIdentifierFilters: [
|
|
724
|
+
{
|
|
725
|
+
contains: 'string',
|
|
726
|
+
startswith: 'string',
|
|
727
|
+
endswith: 'string',
|
|
728
|
+
kind: 'string'
|
|
729
|
+
}
|
|
730
|
+
]
|
|
731
|
+
},
|
|
732
|
+
currentState: 'string',
|
|
733
|
+
customFields: [
|
|
734
|
+
{
|
|
735
|
+
key: 'string',
|
|
736
|
+
value: 'string'
|
|
737
|
+
}
|
|
738
|
+
],
|
|
739
|
+
earliest: 'string',
|
|
740
|
+
groupName: 'string',
|
|
741
|
+
latest: 'string',
|
|
742
|
+
servicePlan: 'string'
|
|
743
|
+
};
|
|
744
|
+
describe('#listUsingPOST - errors', () => {
|
|
745
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
746
|
+
try {
|
|
747
|
+
a.listUsingPOST(devicesListUsingPOSTBodyParam, (data, error) => {
|
|
748
|
+
try {
|
|
749
|
+
if (stub) {
|
|
750
|
+
const displayE = 'Error 400 received on request';
|
|
751
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
752
|
+
} else {
|
|
753
|
+
runCommonAsserts(data, error);
|
|
754
|
+
}
|
|
755
|
+
saveMockData('Devices', 'listUsingPOST', 'default', data);
|
|
756
|
+
done();
|
|
757
|
+
} catch (err) {
|
|
758
|
+
log.error(`Test Failure: ${err}`);
|
|
759
|
+
done(err);
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
} catch (error) {
|
|
763
|
+
log.error(`Adapter Exception: ${error}`);
|
|
764
|
+
done(error);
|
|
765
|
+
}
|
|
766
|
+
}).timeout(attemptTimeout);
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
const devicesImeiIccidMismatchListUsingPOSTBodyParam = {
|
|
770
|
+
devices: [
|
|
771
|
+
{
|
|
772
|
+
deviceIds: [
|
|
773
|
+
{
|
|
774
|
+
id: 'string',
|
|
775
|
+
kind: 'string'
|
|
776
|
+
}
|
|
777
|
+
]
|
|
778
|
+
}
|
|
779
|
+
],
|
|
780
|
+
filter: {
|
|
781
|
+
earliest: 'string',
|
|
782
|
+
latest: 'string'
|
|
783
|
+
},
|
|
784
|
+
accountName: 'string',
|
|
785
|
+
groupName: 'string'
|
|
786
|
+
};
|
|
787
|
+
describe('#imeiIccidMismatchListUsingPOST - errors', () => {
|
|
788
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
789
|
+
try {
|
|
790
|
+
a.imeiIccidMismatchListUsingPOST(devicesImeiIccidMismatchListUsingPOSTBodyParam, (data, error) => {
|
|
791
|
+
try {
|
|
792
|
+
if (stub) {
|
|
793
|
+
const displayE = 'Error 400 received on request';
|
|
794
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
795
|
+
} else {
|
|
796
|
+
runCommonAsserts(data, error);
|
|
797
|
+
}
|
|
798
|
+
saveMockData('Devices', 'imeiIccidMismatchListUsingPOST', 'default', data);
|
|
799
|
+
done();
|
|
800
|
+
} catch (err) {
|
|
801
|
+
log.error(`Test Failure: ${err}`);
|
|
802
|
+
done(err);
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
} catch (error) {
|
|
806
|
+
log.error(`Adapter Exception: ${error}`);
|
|
807
|
+
done(error);
|
|
808
|
+
}
|
|
809
|
+
}).timeout(attemptTimeout);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
const devicesRestoreUsingPOSTBodyParam = {
|
|
813
|
+
accountName: 'string',
|
|
814
|
+
customFields: [
|
|
815
|
+
{
|
|
816
|
+
key: 'string',
|
|
817
|
+
value: 'string'
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
devices: [
|
|
821
|
+
{
|
|
822
|
+
deviceIds: [
|
|
823
|
+
{
|
|
824
|
+
id: 'string',
|
|
825
|
+
kind: 'string'
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
],
|
|
830
|
+
groupName: 'string',
|
|
831
|
+
servicePlan: 'string'
|
|
832
|
+
};
|
|
833
|
+
describe('#restoreUsingPOST - errors', () => {
|
|
834
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
835
|
+
try {
|
|
836
|
+
a.restoreUsingPOST(devicesRestoreUsingPOSTBodyParam, (data, error) => {
|
|
837
|
+
try {
|
|
838
|
+
if (stub) {
|
|
839
|
+
const displayE = 'Error 400 received on request';
|
|
840
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
841
|
+
} else {
|
|
842
|
+
runCommonAsserts(data, error);
|
|
843
|
+
}
|
|
844
|
+
saveMockData('Devices', 'restoreUsingPOST', 'default', data);
|
|
845
|
+
done();
|
|
846
|
+
} catch (err) {
|
|
847
|
+
log.error(`Test Failure: ${err}`);
|
|
848
|
+
done(err);
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
} catch (error) {
|
|
852
|
+
log.error(`Adapter Exception: ${error}`);
|
|
853
|
+
done(error);
|
|
854
|
+
}
|
|
855
|
+
}).timeout(attemptTimeout);
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
const devicesSuspendUsingPOSTBodyParam = {
|
|
859
|
+
accountName: 'string',
|
|
860
|
+
customFields: [
|
|
861
|
+
{
|
|
862
|
+
key: 'string',
|
|
863
|
+
value: 'string'
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
devices: [
|
|
867
|
+
{
|
|
868
|
+
deviceIds: [
|
|
869
|
+
{
|
|
870
|
+
id: 'string',
|
|
871
|
+
kind: 'string'
|
|
872
|
+
}
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
],
|
|
876
|
+
groupName: 'string',
|
|
877
|
+
servicePlan: 'string'
|
|
878
|
+
};
|
|
879
|
+
describe('#suspendUsingPOST - errors', () => {
|
|
880
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
881
|
+
try {
|
|
882
|
+
a.suspendUsingPOST(devicesSuspendUsingPOSTBodyParam, (data, error) => {
|
|
883
|
+
try {
|
|
884
|
+
if (stub) {
|
|
885
|
+
const displayE = 'Error 400 received on request';
|
|
886
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
887
|
+
} else {
|
|
888
|
+
runCommonAsserts(data, error);
|
|
889
|
+
}
|
|
890
|
+
saveMockData('Devices', 'suspendUsingPOST', 'default', data);
|
|
891
|
+
done();
|
|
892
|
+
} catch (err) {
|
|
893
|
+
log.error(`Test Failure: ${err}`);
|
|
894
|
+
done(err);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
} catch (error) {
|
|
898
|
+
log.error(`Adapter Exception: ${error}`);
|
|
899
|
+
done(error);
|
|
900
|
+
}
|
|
901
|
+
}).timeout(attemptTimeout);
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
const devicesDeviceAvailabilityListUsingPOSTBodyParam = {
|
|
905
|
+
accountName: 'string',
|
|
906
|
+
devices: [
|
|
907
|
+
{
|
|
908
|
+
deviceIds: [
|
|
909
|
+
{
|
|
910
|
+
id: 'string',
|
|
911
|
+
kind: 'string'
|
|
912
|
+
}
|
|
913
|
+
]
|
|
914
|
+
}
|
|
915
|
+
]
|
|
916
|
+
};
|
|
917
|
+
describe('#deviceAvailabilityListUsingPOST - errors', () => {
|
|
918
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
919
|
+
try {
|
|
920
|
+
a.deviceAvailabilityListUsingPOST(devicesDeviceAvailabilityListUsingPOSTBodyParam, (data, error) => {
|
|
921
|
+
try {
|
|
922
|
+
if (stub) {
|
|
923
|
+
const displayE = 'Error 400 received on request';
|
|
924
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
925
|
+
} else {
|
|
926
|
+
runCommonAsserts(data, error);
|
|
927
|
+
}
|
|
928
|
+
saveMockData('Devices', 'deviceAvailabilityListUsingPOST', 'default', data);
|
|
929
|
+
done();
|
|
930
|
+
} catch (err) {
|
|
931
|
+
log.error(`Test Failure: ${err}`);
|
|
932
|
+
done(err);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
} catch (error) {
|
|
936
|
+
log.error(`Adapter Exception: ${error}`);
|
|
937
|
+
done(error);
|
|
938
|
+
}
|
|
939
|
+
}).timeout(attemptTimeout);
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
const devicesConnectionListHistoryUsingPOSTBodyParam = {
|
|
943
|
+
deviceId: {
|
|
944
|
+
id: 'string',
|
|
945
|
+
kind: 'string'
|
|
946
|
+
},
|
|
947
|
+
earliest: 'string',
|
|
948
|
+
latest: 'string'
|
|
949
|
+
};
|
|
950
|
+
describe('#connectionListHistoryUsingPOST - errors', () => {
|
|
951
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
952
|
+
try {
|
|
953
|
+
a.connectionListHistoryUsingPOST(devicesConnectionListHistoryUsingPOSTBodyParam, (data, error) => {
|
|
954
|
+
try {
|
|
955
|
+
if (stub) {
|
|
956
|
+
runCommonAsserts(data, error);
|
|
957
|
+
assert.equal('object', typeof data.response[0]);
|
|
958
|
+
assert.equal('object', typeof data.response[1]);
|
|
959
|
+
assert.equal('object', typeof data.response[2]);
|
|
960
|
+
} else {
|
|
961
|
+
runCommonAsserts(data, error);
|
|
962
|
+
}
|
|
963
|
+
saveMockData('Devices', 'connectionListHistoryUsingPOST', 'default', data);
|
|
964
|
+
done();
|
|
965
|
+
} catch (err) {
|
|
966
|
+
log.error(`Test Failure: ${err}`);
|
|
967
|
+
done(err);
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
} catch (error) {
|
|
971
|
+
log.error(`Adapter Exception: ${error}`);
|
|
972
|
+
done(error);
|
|
973
|
+
}
|
|
974
|
+
}).timeout(attemptTimeout);
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
const devicesGetExtendedDiagsUsingPOSTBodyParam = {
|
|
978
|
+
accountName: 'string',
|
|
979
|
+
deviceList: [
|
|
980
|
+
{}
|
|
981
|
+
]
|
|
982
|
+
};
|
|
983
|
+
describe('#getExtendedDiagsUsingPOST - errors', () => {
|
|
984
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
985
|
+
try {
|
|
986
|
+
a.getExtendedDiagsUsingPOST(devicesGetExtendedDiagsUsingPOSTBodyParam, (data, error) => {
|
|
987
|
+
try {
|
|
988
|
+
if (stub) {
|
|
989
|
+
const displayE = 'Error 400 received on request';
|
|
990
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
991
|
+
} else {
|
|
992
|
+
runCommonAsserts(data, error);
|
|
993
|
+
}
|
|
994
|
+
saveMockData('Devices', 'getExtendedDiagsUsingPOST', 'default', data);
|
|
995
|
+
done();
|
|
996
|
+
} catch (err) {
|
|
997
|
+
log.error(`Test Failure: ${err}`);
|
|
998
|
+
done(err);
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
} catch (error) {
|
|
1002
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1003
|
+
done(error);
|
|
1004
|
+
}
|
|
1005
|
+
}).timeout(attemptTimeout);
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
const devicesProvisioningHistoryListUsingPOSTBodyParam = {
|
|
1009
|
+
deviceId: {
|
|
1010
|
+
id: 'string',
|
|
1011
|
+
kind: 'string'
|
|
1012
|
+
},
|
|
1013
|
+
earliest: 'string',
|
|
1014
|
+
latest: 'string'
|
|
1015
|
+
};
|
|
1016
|
+
describe('#provisioningHistoryListUsingPOST - errors', () => {
|
|
1017
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1018
|
+
try {
|
|
1019
|
+
a.provisioningHistoryListUsingPOST(devicesProvisioningHistoryListUsingPOSTBodyParam, (data, error) => {
|
|
1020
|
+
try {
|
|
1021
|
+
if (stub) {
|
|
1022
|
+
runCommonAsserts(data, error);
|
|
1023
|
+
assert.equal('object', typeof data.response[0]);
|
|
1024
|
+
assert.equal('object', typeof data.response[1]);
|
|
1025
|
+
} else {
|
|
1026
|
+
runCommonAsserts(data, error);
|
|
1027
|
+
}
|
|
1028
|
+
saveMockData('Devices', 'provisioningHistoryListUsingPOST', 'default', data);
|
|
1029
|
+
done();
|
|
1030
|
+
} catch (err) {
|
|
1031
|
+
log.error(`Test Failure: ${err}`);
|
|
1032
|
+
done(err);
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
} catch (error) {
|
|
1036
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1037
|
+
done(error);
|
|
1038
|
+
}
|
|
1039
|
+
}).timeout(attemptTimeout);
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
const devicesPrlListUsingPOSTBodyParam = {
|
|
1043
|
+
deviceIds: [
|
|
1044
|
+
{
|
|
1045
|
+
id: 'string',
|
|
1046
|
+
kind: 'string'
|
|
1047
|
+
}
|
|
1048
|
+
],
|
|
1049
|
+
accountName: 'string',
|
|
1050
|
+
customFields: [
|
|
1051
|
+
{
|
|
1052
|
+
key: 'string',
|
|
1053
|
+
value: 'string'
|
|
1054
|
+
}
|
|
1055
|
+
],
|
|
1056
|
+
groupName: 'string',
|
|
1057
|
+
servicePlan: 'string'
|
|
1058
|
+
};
|
|
1059
|
+
describe('#prlListUsingPOST - errors', () => {
|
|
1060
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1061
|
+
try {
|
|
1062
|
+
a.prlListUsingPOST(devicesPrlListUsingPOSTBodyParam, (data, error) => {
|
|
1063
|
+
try {
|
|
1064
|
+
if (stub) {
|
|
1065
|
+
const displayE = 'Error 400 received on request';
|
|
1066
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1067
|
+
} else {
|
|
1068
|
+
runCommonAsserts(data, error);
|
|
1069
|
+
}
|
|
1070
|
+
saveMockData('Devices', 'prlListUsingPOST', 'default', data);
|
|
1071
|
+
done();
|
|
1072
|
+
} catch (err) {
|
|
1073
|
+
log.error(`Test Failure: ${err}`);
|
|
1074
|
+
done(err);
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
} catch (error) {
|
|
1078
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1079
|
+
done(error);
|
|
1080
|
+
}
|
|
1081
|
+
}).timeout(attemptTimeout);
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
const devicesGetDeviceSuspensionStatusUsingPOSTBodyParam = {
|
|
1085
|
+
deviceIds: [
|
|
1086
|
+
{
|
|
1087
|
+
id: 'string',
|
|
1088
|
+
kind: 'string'
|
|
1089
|
+
}
|
|
1090
|
+
],
|
|
1091
|
+
filter: {
|
|
1092
|
+
groupName: 'string',
|
|
1093
|
+
servicePlan: 'string',
|
|
1094
|
+
customFields: [
|
|
1095
|
+
{
|
|
1096
|
+
key: 'string',
|
|
1097
|
+
value: 'string'
|
|
1098
|
+
}
|
|
1099
|
+
]
|
|
1100
|
+
},
|
|
1101
|
+
accountName: 'string'
|
|
1102
|
+
};
|
|
1103
|
+
describe('#getDeviceSuspensionStatusUsingPOST - errors', () => {
|
|
1104
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1105
|
+
try {
|
|
1106
|
+
a.getDeviceSuspensionStatusUsingPOST(devicesGetDeviceSuspensionStatusUsingPOSTBodyParam, (data, error) => {
|
|
1107
|
+
try {
|
|
1108
|
+
if (stub) {
|
|
1109
|
+
const displayE = 'Error 400 received on request';
|
|
1110
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1111
|
+
} else {
|
|
1112
|
+
runCommonAsserts(data, error);
|
|
1113
|
+
}
|
|
1114
|
+
saveMockData('Devices', 'getDeviceSuspensionStatusUsingPOST', 'default', data);
|
|
1115
|
+
done();
|
|
1116
|
+
} catch (err) {
|
|
1117
|
+
log.error(`Test Failure: ${err}`);
|
|
1118
|
+
done(err);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
} catch (error) {
|
|
1122
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1123
|
+
done(error);
|
|
1124
|
+
}
|
|
1125
|
+
}).timeout(attemptTimeout);
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
const devicesUsageListUsingPOSTBodyParam = {
|
|
1129
|
+
deviceId: {
|
|
1130
|
+
id: 'string',
|
|
1131
|
+
kind: 'string'
|
|
1132
|
+
},
|
|
1133
|
+
earliest: 'string',
|
|
1134
|
+
latest: 'string'
|
|
1135
|
+
};
|
|
1136
|
+
describe('#usageListUsingPOST - errors', () => {
|
|
1137
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1138
|
+
try {
|
|
1139
|
+
a.usageListUsingPOST(devicesUsageListUsingPOSTBodyParam, (data, error) => {
|
|
1140
|
+
try {
|
|
1141
|
+
if (stub) {
|
|
1142
|
+
runCommonAsserts(data, error);
|
|
1143
|
+
assert.equal('object', typeof data.response[0]);
|
|
1144
|
+
} else {
|
|
1145
|
+
runCommonAsserts(data, error);
|
|
1146
|
+
}
|
|
1147
|
+
saveMockData('Devices', 'usageListUsingPOST', 'default', data);
|
|
1148
|
+
done();
|
|
1149
|
+
} catch (err) {
|
|
1150
|
+
log.error(`Test Failure: ${err}`);
|
|
1151
|
+
done(err);
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
} catch (error) {
|
|
1155
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1156
|
+
done(error);
|
|
1157
|
+
}
|
|
1158
|
+
}).timeout(attemptTimeout);
|
|
1159
|
+
});
|
|
1160
|
+
|
|
1161
|
+
const devicesAggregateUsingPOSTBodyParam = {
|
|
1162
|
+
deviceIds: [
|
|
1163
|
+
{
|
|
1164
|
+
id: 'string',
|
|
1165
|
+
kind: 'string'
|
|
1166
|
+
}
|
|
1167
|
+
],
|
|
1168
|
+
accountName: 'string',
|
|
1169
|
+
groupName: 'string',
|
|
1170
|
+
startTime: 'string',
|
|
1171
|
+
endTime: 'string'
|
|
1172
|
+
};
|
|
1173
|
+
describe('#aggregateUsingPOST - errors', () => {
|
|
1174
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1175
|
+
try {
|
|
1176
|
+
a.aggregateUsingPOST(devicesAggregateUsingPOSTBodyParam, (data, error) => {
|
|
1177
|
+
try {
|
|
1178
|
+
if (stub) {
|
|
1179
|
+
const displayE = 'Error 400 received on request';
|
|
1180
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1181
|
+
} else {
|
|
1182
|
+
runCommonAsserts(data, error);
|
|
1183
|
+
}
|
|
1184
|
+
saveMockData('Devices', 'aggregateUsingPOST', 'default', data);
|
|
1185
|
+
done();
|
|
1186
|
+
} catch (err) {
|
|
1187
|
+
log.error(`Test Failure: ${err}`);
|
|
1188
|
+
done(err);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
} catch (error) {
|
|
1192
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1193
|
+
done(error);
|
|
1194
|
+
}
|
|
1195
|
+
}).timeout(attemptTimeout);
|
|
1196
|
+
});
|
|
1197
|
+
|
|
1198
|
+
const devicesUpdateContactInfoUsingPUTBodyParam = {
|
|
1199
|
+
accountName: 'string',
|
|
1200
|
+
devices: [
|
|
1201
|
+
{
|
|
1202
|
+
deviceIds: [
|
|
1203
|
+
{
|
|
1204
|
+
id: 'string',
|
|
1205
|
+
kind: 'string'
|
|
1206
|
+
}
|
|
1207
|
+
]
|
|
1208
|
+
}
|
|
1209
|
+
],
|
|
1210
|
+
primaryPlaceOfUse: {}
|
|
1211
|
+
};
|
|
1212
|
+
describe('#updateContactInfoUsingPUT - errors', () => {
|
|
1213
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1214
|
+
try {
|
|
1215
|
+
a.updateContactInfoUsingPUT(devicesUpdateContactInfoUsingPUTBodyParam, (data, error) => {
|
|
1216
|
+
try {
|
|
1217
|
+
if (stub) {
|
|
1218
|
+
const displayE = 'Error 400 received on request';
|
|
1219
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1220
|
+
} else {
|
|
1221
|
+
runCommonAsserts(data, error);
|
|
1222
|
+
}
|
|
1223
|
+
saveMockData('Devices', 'updateContactInfoUsingPUT', 'default', data);
|
|
1224
|
+
done();
|
|
1225
|
+
} catch (err) {
|
|
1226
|
+
log.error(`Test Failure: ${err}`);
|
|
1227
|
+
done(err);
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
} catch (error) {
|
|
1231
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1232
|
+
done(error);
|
|
1233
|
+
}
|
|
1234
|
+
}).timeout(attemptTimeout);
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
const devicesUpdateCustomFieldsUsingPUTBodyParam = {
|
|
1238
|
+
accountName: 'string',
|
|
1239
|
+
customFields: [
|
|
1240
|
+
{
|
|
1241
|
+
key: 'string',
|
|
1242
|
+
value: 'string'
|
|
1243
|
+
}
|
|
1244
|
+
],
|
|
1245
|
+
customFieldsToUpdate: [
|
|
1246
|
+
{
|
|
1247
|
+
key: 'string',
|
|
1248
|
+
value: 'string'
|
|
1249
|
+
}
|
|
1250
|
+
],
|
|
1251
|
+
devices: [
|
|
1252
|
+
{
|
|
1253
|
+
deviceIds: [
|
|
1254
|
+
{
|
|
1255
|
+
id: 'string',
|
|
1256
|
+
kind: 'string'
|
|
1257
|
+
}
|
|
1258
|
+
]
|
|
1259
|
+
}
|
|
1260
|
+
],
|
|
1261
|
+
groupName: 'string',
|
|
1262
|
+
servicePlan: 'string'
|
|
1263
|
+
};
|
|
1264
|
+
describe('#updateCustomFieldsUsingPUT - errors', () => {
|
|
1265
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1266
|
+
try {
|
|
1267
|
+
a.updateCustomFieldsUsingPUT(devicesUpdateCustomFieldsUsingPUTBodyParam, (data, error) => {
|
|
1268
|
+
try {
|
|
1269
|
+
if (stub) {
|
|
1270
|
+
const displayE = 'Error 400 received on request';
|
|
1271
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1272
|
+
} else {
|
|
1273
|
+
runCommonAsserts(data, error);
|
|
1274
|
+
}
|
|
1275
|
+
saveMockData('Devices', 'updateCustomFieldsUsingPUT', 'default', data);
|
|
1276
|
+
done();
|
|
1277
|
+
} catch (err) {
|
|
1278
|
+
log.error(`Test Failure: ${err}`);
|
|
1279
|
+
done(err);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
} catch (error) {
|
|
1283
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1284
|
+
done(error);
|
|
1285
|
+
}
|
|
1286
|
+
}).timeout(attemptTimeout);
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
const devicesGotostateUsingPutBodyParam = {
|
|
1290
|
+
devices: [
|
|
1291
|
+
{
|
|
1292
|
+
deviceIds: [
|
|
1293
|
+
{
|
|
1294
|
+
id: 'string',
|
|
1295
|
+
kind: 'string'
|
|
1296
|
+
}
|
|
1297
|
+
]
|
|
1298
|
+
}
|
|
1299
|
+
],
|
|
1300
|
+
filter: {
|
|
1301
|
+
account: 'string',
|
|
1302
|
+
groupName: 'string',
|
|
1303
|
+
servicePlan: 'string',
|
|
1304
|
+
customFields: [
|
|
1305
|
+
{
|
|
1306
|
+
key: 'string',
|
|
1307
|
+
value: 'string'
|
|
1308
|
+
}
|
|
1309
|
+
]
|
|
1310
|
+
},
|
|
1311
|
+
serviceName: 'string',
|
|
1312
|
+
stateName: 'string',
|
|
1313
|
+
servicePlan: 'string',
|
|
1314
|
+
mdnZipCode: 'string',
|
|
1315
|
+
carrierIpPoolName: 'string',
|
|
1316
|
+
publicIpRestriction: 'string',
|
|
1317
|
+
skuNumber: 'string',
|
|
1318
|
+
customFields: [
|
|
1319
|
+
{
|
|
1320
|
+
key: 'string',
|
|
1321
|
+
value: 'string'
|
|
1322
|
+
}
|
|
1323
|
+
],
|
|
1324
|
+
groupName: 'string',
|
|
1325
|
+
primaryPlaceOfUse: {
|
|
1326
|
+
address: {
|
|
1327
|
+
addressLine1: 'string',
|
|
1328
|
+
addressLine2: 'string',
|
|
1329
|
+
city: 'string',
|
|
1330
|
+
state: 'string',
|
|
1331
|
+
zip: 'string',
|
|
1332
|
+
zip4: 'string',
|
|
1333
|
+
country: 'string',
|
|
1334
|
+
phone: 'string',
|
|
1335
|
+
phoneType: 'string',
|
|
1336
|
+
emailAddress: 'string'
|
|
1337
|
+
},
|
|
1338
|
+
customerName: {
|
|
1339
|
+
title: 'string',
|
|
1340
|
+
firstName: 'string',
|
|
1341
|
+
middleName: 'string',
|
|
1342
|
+
lastName: 'string',
|
|
1343
|
+
suffix: 'string'
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
describe('#gotostateUsingPut - errors', () => {
|
|
1348
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1349
|
+
try {
|
|
1350
|
+
a.gotostateUsingPut(devicesGotostateUsingPutBodyParam, (data, error) => {
|
|
1351
|
+
try {
|
|
1352
|
+
if (stub) {
|
|
1353
|
+
const displayE = 'Error 400 received on request';
|
|
1354
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1355
|
+
} else {
|
|
1356
|
+
runCommonAsserts(data, error);
|
|
1357
|
+
}
|
|
1358
|
+
saveMockData('Devices', 'gotostateUsingPut', 'default', data);
|
|
1359
|
+
done();
|
|
1360
|
+
} catch (err) {
|
|
1361
|
+
log.error(`Test Failure: ${err}`);
|
|
1362
|
+
done(err);
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
} catch (error) {
|
|
1366
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1367
|
+
done(error);
|
|
1368
|
+
}
|
|
1369
|
+
}).timeout(attemptTimeout);
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
const devicesMoveUsingPutBodyParam = {
|
|
1373
|
+
accountName: 'string',
|
|
1374
|
+
filter: {
|
|
1375
|
+
account: 'string',
|
|
1376
|
+
groupName: 'string',
|
|
1377
|
+
servicePlan: 'string',
|
|
1378
|
+
customFields: [
|
|
1379
|
+
{
|
|
1380
|
+
key: 'string',
|
|
1381
|
+
value: 'string'
|
|
1382
|
+
}
|
|
1383
|
+
]
|
|
1384
|
+
},
|
|
1385
|
+
customFields: [
|
|
1386
|
+
{
|
|
1387
|
+
key: 'string',
|
|
1388
|
+
value: 'string'
|
|
1389
|
+
}
|
|
1390
|
+
],
|
|
1391
|
+
devices: [
|
|
1392
|
+
{
|
|
1393
|
+
deviceIds: [
|
|
1394
|
+
{
|
|
1395
|
+
id: 'string',
|
|
1396
|
+
kind: 'string'
|
|
1397
|
+
}
|
|
1398
|
+
]
|
|
1399
|
+
}
|
|
1400
|
+
],
|
|
1401
|
+
groupName: 'string',
|
|
1402
|
+
carrierIpPoolName: 'string',
|
|
1403
|
+
servicePlan: 'string'
|
|
1404
|
+
};
|
|
1405
|
+
describe('#moveUsingPut - errors', () => {
|
|
1406
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1407
|
+
try {
|
|
1408
|
+
a.moveUsingPut(devicesMoveUsingPutBodyParam, (data, error) => {
|
|
1409
|
+
try {
|
|
1410
|
+
if (stub) {
|
|
1411
|
+
const displayE = 'Error 400 received on request';
|
|
1412
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1413
|
+
} else {
|
|
1414
|
+
runCommonAsserts(data, error);
|
|
1415
|
+
}
|
|
1416
|
+
saveMockData('Devices', 'moveUsingPut', 'default', data);
|
|
1417
|
+
done();
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
log.error(`Test Failure: ${err}`);
|
|
1420
|
+
done(err);
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
} catch (error) {
|
|
1424
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1425
|
+
done(error);
|
|
1426
|
+
}
|
|
1427
|
+
}).timeout(attemptTimeout);
|
|
1428
|
+
});
|
|
1429
|
+
|
|
1430
|
+
const devicesUpdateServicePlanUsingPUTBodyParam = {
|
|
1431
|
+
accountName: 'string',
|
|
1432
|
+
currentServicePlan: 'string',
|
|
1433
|
+
customFields: [
|
|
1434
|
+
{
|
|
1435
|
+
key: 'string',
|
|
1436
|
+
value: 'string'
|
|
1437
|
+
}
|
|
1438
|
+
],
|
|
1439
|
+
devices: [
|
|
1440
|
+
{
|
|
1441
|
+
deviceIds: [
|
|
1442
|
+
{
|
|
1443
|
+
id: 'string',
|
|
1444
|
+
kind: 'string'
|
|
1445
|
+
}
|
|
1446
|
+
]
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
groupName: 'string',
|
|
1450
|
+
servicePlan: 'string'
|
|
1451
|
+
};
|
|
1452
|
+
describe('#updateServicePlanUsingPUT - errors', () => {
|
|
1453
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1454
|
+
try {
|
|
1455
|
+
a.updateServicePlanUsingPUT(devicesUpdateServicePlanUsingPUTBodyParam, (data, error) => {
|
|
1456
|
+
try {
|
|
1457
|
+
if (stub) {
|
|
1458
|
+
const displayE = 'Error 400 received on request';
|
|
1459
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1460
|
+
} else {
|
|
1461
|
+
runCommonAsserts(data, error);
|
|
1462
|
+
}
|
|
1463
|
+
saveMockData('Devices', 'updateServicePlanUsingPUT', 'default', data);
|
|
1464
|
+
done();
|
|
1465
|
+
} catch (err) {
|
|
1466
|
+
log.error(`Test Failure: ${err}`);
|
|
1467
|
+
done(err);
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
} catch (error) {
|
|
1471
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1472
|
+
done(error);
|
|
1473
|
+
}
|
|
1474
|
+
}).timeout(attemptTimeout);
|
|
1475
|
+
});
|
|
1476
|
+
|
|
1477
|
+
const devicesChangeCostCenterUsingPUTBodyParam = {
|
|
1478
|
+
accountName: 'string',
|
|
1479
|
+
costCenter: 'string',
|
|
1480
|
+
customFields: [
|
|
1481
|
+
{
|
|
1482
|
+
key: 'string',
|
|
1483
|
+
value: 'string'
|
|
1484
|
+
}
|
|
1485
|
+
],
|
|
1486
|
+
devices: [
|
|
1487
|
+
{
|
|
1488
|
+
deviceIds: [
|
|
1489
|
+
{
|
|
1490
|
+
id: 'string',
|
|
1491
|
+
kind: 'string'
|
|
1492
|
+
}
|
|
1493
|
+
]
|
|
1494
|
+
}
|
|
1495
|
+
],
|
|
1496
|
+
groupName: 'string',
|
|
1497
|
+
primaryPlaceOfUse: {},
|
|
1498
|
+
removeCostCenter: false,
|
|
1499
|
+
servicePlan: 'string'
|
|
1500
|
+
};
|
|
1501
|
+
describe('#changeCostCenterUsingPUT - errors', () => {
|
|
1502
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1503
|
+
try {
|
|
1504
|
+
a.changeCostCenterUsingPUT(devicesChangeCostCenterUsingPUTBodyParam, (data, error) => {
|
|
1505
|
+
try {
|
|
1506
|
+
if (stub) {
|
|
1507
|
+
const displayE = 'Error 400 received on request';
|
|
1508
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1509
|
+
} else {
|
|
1510
|
+
runCommonAsserts(data, error);
|
|
1511
|
+
}
|
|
1512
|
+
saveMockData('Devices', 'changeCostCenterUsingPUT', 'default', data);
|
|
1513
|
+
done();
|
|
1514
|
+
} catch (err) {
|
|
1515
|
+
log.error(`Test Failure: ${err}`);
|
|
1516
|
+
done(err);
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
} catch (error) {
|
|
1520
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1521
|
+
done(error);
|
|
1522
|
+
}
|
|
1523
|
+
}).timeout(attemptTimeout);
|
|
1524
|
+
});
|
|
1525
|
+
|
|
1526
|
+
const devicesServiceType = 'fakedata';
|
|
1527
|
+
const devicesChangeDeviceIdUsingPUTBodyParam = {
|
|
1528
|
+
assignNonGeoMdn: false,
|
|
1529
|
+
change4gOption: 'string',
|
|
1530
|
+
deviceIds: [
|
|
1531
|
+
{
|
|
1532
|
+
id: 'string',
|
|
1533
|
+
kind: 'string'
|
|
1534
|
+
}
|
|
1535
|
+
],
|
|
1536
|
+
deviceIdsTo: [
|
|
1537
|
+
{
|
|
1538
|
+
id: 'string',
|
|
1539
|
+
kind: 'string'
|
|
1540
|
+
}
|
|
1541
|
+
],
|
|
1542
|
+
npaNxx: 'string',
|
|
1543
|
+
servicePlan: 'string',
|
|
1544
|
+
zipCode: 'string'
|
|
1545
|
+
};
|
|
1546
|
+
describe('#changeDeviceIdUsingPUT - errors', () => {
|
|
1547
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1548
|
+
try {
|
|
1549
|
+
a.changeDeviceIdUsingPUT(devicesServiceType, devicesChangeDeviceIdUsingPUTBodyParam, (data, error) => {
|
|
1550
|
+
try {
|
|
1551
|
+
if (stub) {
|
|
1552
|
+
const displayE = 'Error 400 received on request';
|
|
1553
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1554
|
+
} else {
|
|
1555
|
+
runCommonAsserts(data, error);
|
|
1556
|
+
}
|
|
1557
|
+
saveMockData('Devices', 'changeDeviceIdUsingPUT', 'default', data);
|
|
1558
|
+
done();
|
|
1559
|
+
} catch (err) {
|
|
1560
|
+
log.error(`Test Failure: ${err}`);
|
|
1561
|
+
done(err);
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
} catch (error) {
|
|
1565
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1566
|
+
done(error);
|
|
1567
|
+
}
|
|
1568
|
+
}).timeout(attemptTimeout);
|
|
1569
|
+
});
|
|
1570
|
+
|
|
1571
|
+
const groupsCreateDeviceGroupUsingPOSTBodyParam = {
|
|
1572
|
+
accountName: 'string',
|
|
1573
|
+
devicesToAdd: [
|
|
1574
|
+
{
|
|
1575
|
+
id: 'string',
|
|
1576
|
+
kind: 'string'
|
|
1577
|
+
}
|
|
1578
|
+
],
|
|
1579
|
+
groupDescription: 'string',
|
|
1580
|
+
groupName: 'string'
|
|
1581
|
+
};
|
|
1582
|
+
describe('#createDeviceGroupUsingPOST - errors', () => {
|
|
1583
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1584
|
+
try {
|
|
1585
|
+
a.createDeviceGroupUsingPOST(groupsCreateDeviceGroupUsingPOSTBodyParam, (data, error) => {
|
|
1586
|
+
try {
|
|
1587
|
+
if (stub) {
|
|
1588
|
+
const displayE = 'Error 400 received on request';
|
|
1589
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1590
|
+
} else {
|
|
1591
|
+
runCommonAsserts(data, error);
|
|
1592
|
+
}
|
|
1593
|
+
saveMockData('Groups', 'createDeviceGroupUsingPOST', 'default', data);
|
|
1594
|
+
done();
|
|
1595
|
+
} catch (err) {
|
|
1596
|
+
log.error(`Test Failure: ${err}`);
|
|
1597
|
+
done(err);
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
} catch (error) {
|
|
1601
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1602
|
+
done(error);
|
|
1603
|
+
}
|
|
1604
|
+
}).timeout(attemptTimeout);
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
const groupsAname = 'fakedata';
|
|
1608
|
+
describe('#getListUsingGET - errors', () => {
|
|
1609
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1610
|
+
try {
|
|
1611
|
+
a.getListUsingGET(groupsAname, (data, error) => {
|
|
1612
|
+
try {
|
|
1613
|
+
if (stub) {
|
|
1614
|
+
runCommonAsserts(data, error);
|
|
1615
|
+
assert.equal('object', typeof data.response[0]);
|
|
1616
|
+
assert.equal('object', typeof data.response[1]);
|
|
1617
|
+
} else {
|
|
1618
|
+
runCommonAsserts(data, error);
|
|
1619
|
+
}
|
|
1620
|
+
saveMockData('Groups', 'getListUsingGET', 'default', data);
|
|
1621
|
+
done();
|
|
1622
|
+
} catch (err) {
|
|
1623
|
+
log.error(`Test Failure: ${err}`);
|
|
1624
|
+
done(err);
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
} catch (error) {
|
|
1628
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1629
|
+
done(error);
|
|
1630
|
+
}
|
|
1631
|
+
}).timeout(attemptTimeout);
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
const groupsGname = 'fakedata';
|
|
1635
|
+
const groupsUpdateDeviceGroupUsingPUTBodyParam = {
|
|
1636
|
+
devicesToAdd: [
|
|
1637
|
+
{
|
|
1638
|
+
id: 'string',
|
|
1639
|
+
kind: 'string'
|
|
1640
|
+
}
|
|
1641
|
+
],
|
|
1642
|
+
devicesToRemove: [
|
|
1643
|
+
{
|
|
1644
|
+
id: 'string',
|
|
1645
|
+
kind: 'string'
|
|
1646
|
+
}
|
|
1647
|
+
],
|
|
1648
|
+
newGroupDescription: 'string',
|
|
1649
|
+
newGroupName: 'string'
|
|
1650
|
+
};
|
|
1651
|
+
describe('#updateDeviceGroupUsingPUT - errors', () => {
|
|
1652
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1653
|
+
try {
|
|
1654
|
+
a.updateDeviceGroupUsingPUT(groupsAname, groupsGname, groupsUpdateDeviceGroupUsingPUTBodyParam, (data, error) => {
|
|
1655
|
+
try {
|
|
1656
|
+
if (stub) {
|
|
1657
|
+
const displayE = 'Error 400 received on request';
|
|
1658
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1659
|
+
} else {
|
|
1660
|
+
runCommonAsserts(data, error);
|
|
1661
|
+
}
|
|
1662
|
+
saveMockData('Groups', 'updateDeviceGroupUsingPUT', 'default', data);
|
|
1663
|
+
done();
|
|
1664
|
+
} catch (err) {
|
|
1665
|
+
log.error(`Test Failure: ${err}`);
|
|
1666
|
+
done(err);
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
} catch (error) {
|
|
1670
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1671
|
+
done(error);
|
|
1672
|
+
}
|
|
1673
|
+
}).timeout(attemptTimeout);
|
|
1674
|
+
});
|
|
1675
|
+
|
|
1676
|
+
describe('#getDeviceGroupInfoUsingGET - errors', () => {
|
|
1677
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1678
|
+
try {
|
|
1679
|
+
a.getDeviceGroupInfoUsingGET(groupsAname, groupsGname, null, (data, error) => {
|
|
1680
|
+
try {
|
|
1681
|
+
if (stub) {
|
|
1682
|
+
const displayE = 'Error 400 received on request';
|
|
1683
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1684
|
+
} else {
|
|
1685
|
+
runCommonAsserts(data, error);
|
|
1686
|
+
}
|
|
1687
|
+
saveMockData('Groups', 'getDeviceGroupInfoUsingGET', 'default', data);
|
|
1688
|
+
done();
|
|
1689
|
+
} catch (err) {
|
|
1690
|
+
log.error(`Test Failure: ${err}`);
|
|
1691
|
+
done(err);
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
} catch (error) {
|
|
1695
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1696
|
+
done(error);
|
|
1697
|
+
}
|
|
1698
|
+
}).timeout(attemptTimeout);
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
const plansAname = 'fakedata';
|
|
1702
|
+
describe('#getServicePlanListUsingGET - errors', () => {
|
|
1703
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1704
|
+
try {
|
|
1705
|
+
a.getServicePlanListUsingGET(plansAname, (data, error) => {
|
|
1706
|
+
try {
|
|
1707
|
+
if (stub) {
|
|
1708
|
+
runCommonAsserts(data, error);
|
|
1709
|
+
assert.equal('object', typeof data.response[0]);
|
|
1710
|
+
assert.equal('object', typeof data.response[1]);
|
|
1711
|
+
assert.equal('object', typeof data.response[2]);
|
|
1712
|
+
} else {
|
|
1713
|
+
runCommonAsserts(data, error);
|
|
1714
|
+
}
|
|
1715
|
+
saveMockData('Plans', 'getServicePlanListUsingGET', 'default', data);
|
|
1716
|
+
done();
|
|
1717
|
+
} catch (err) {
|
|
1718
|
+
log.error(`Test Failure: ${err}`);
|
|
1719
|
+
done(err);
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
} catch (error) {
|
|
1723
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1724
|
+
done(error);
|
|
1725
|
+
}
|
|
1726
|
+
}).timeout(attemptTimeout);
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
const sessionLoginUsingPOSTBodyParam = {
|
|
1730
|
+
username: 'string',
|
|
1731
|
+
password: 'string'
|
|
1732
|
+
};
|
|
1733
|
+
describe('#loginUsingPOST - errors', () => {
|
|
1734
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1735
|
+
try {
|
|
1736
|
+
a.loginUsingPOST(sessionLoginUsingPOSTBodyParam, (data, error) => {
|
|
1737
|
+
try {
|
|
1738
|
+
if (stub) {
|
|
1739
|
+
const displayE = 'Error 400 received on request';
|
|
1740
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1741
|
+
} else {
|
|
1742
|
+
runCommonAsserts(data, error);
|
|
1743
|
+
}
|
|
1744
|
+
saveMockData('Session', 'loginUsingPOST', 'default', data);
|
|
1745
|
+
done();
|
|
1746
|
+
} catch (err) {
|
|
1747
|
+
log.error(`Test Failure: ${err}`);
|
|
1748
|
+
done(err);
|
|
1749
|
+
}
|
|
1750
|
+
});
|
|
1751
|
+
} catch (error) {
|
|
1752
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1753
|
+
done(error);
|
|
1754
|
+
}
|
|
1755
|
+
}).timeout(attemptTimeout);
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
describe('#logoutUsingPOST - errors', () => {
|
|
1759
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1760
|
+
try {
|
|
1761
|
+
a.logoutUsingPOST((data, error) => {
|
|
1762
|
+
try {
|
|
1763
|
+
if (stub) {
|
|
1764
|
+
const displayE = 'Error 400 received on request';
|
|
1765
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1766
|
+
} else {
|
|
1767
|
+
runCommonAsserts(data, error);
|
|
1768
|
+
}
|
|
1769
|
+
saveMockData('Session', 'logoutUsingPOST', 'default', data);
|
|
1770
|
+
done();
|
|
1771
|
+
} catch (err) {
|
|
1772
|
+
log.error(`Test Failure: ${err}`);
|
|
1773
|
+
done(err);
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
1776
|
+
} catch (error) {
|
|
1777
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1778
|
+
done(error);
|
|
1779
|
+
}
|
|
1780
|
+
}).timeout(attemptTimeout);
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
const sessionResetUsingPUTBodyParam = {
|
|
1784
|
+
oldPassword: 'string'
|
|
1785
|
+
};
|
|
1786
|
+
describe('#resetUsingPUT - errors', () => {
|
|
1787
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1788
|
+
try {
|
|
1789
|
+
a.resetUsingPUT(sessionResetUsingPUTBodyParam, (data, error) => {
|
|
1790
|
+
try {
|
|
1791
|
+
if (stub) {
|
|
1792
|
+
const displayE = 'Error 400 received on request';
|
|
1793
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1794
|
+
} else {
|
|
1795
|
+
runCommonAsserts(data, error);
|
|
1796
|
+
}
|
|
1797
|
+
saveMockData('Session', 'resetUsingPUT', 'default', data);
|
|
1798
|
+
done();
|
|
1799
|
+
} catch (err) {
|
|
1800
|
+
log.error(`Test Failure: ${err}`);
|
|
1801
|
+
done(err);
|
|
1802
|
+
}
|
|
1803
|
+
});
|
|
1804
|
+
} catch (error) {
|
|
1805
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1806
|
+
done(error);
|
|
1807
|
+
}
|
|
1808
|
+
}).timeout(attemptTimeout);
|
|
1809
|
+
});
|
|
1810
|
+
|
|
1811
|
+
const smsSendSmsMessageUsingPOSTBodyParam = {
|
|
1812
|
+
accountName: 'string',
|
|
1813
|
+
customFields: [
|
|
1814
|
+
{
|
|
1815
|
+
key: 'string',
|
|
1816
|
+
value: 'string'
|
|
1817
|
+
}
|
|
1818
|
+
],
|
|
1819
|
+
dataEncoding: 'string',
|
|
1820
|
+
deviceIds: [
|
|
1821
|
+
{
|
|
1822
|
+
id: 'string',
|
|
1823
|
+
kind: 'string'
|
|
1824
|
+
}
|
|
1825
|
+
],
|
|
1826
|
+
groupName: 'string',
|
|
1827
|
+
servicePlan: 'string',
|
|
1828
|
+
smsMessage: 'string'
|
|
1829
|
+
};
|
|
1830
|
+
describe('#sendSmsMessageUsingPOST - errors', () => {
|
|
1831
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1832
|
+
try {
|
|
1833
|
+
a.sendSmsMessageUsingPOST(smsSendSmsMessageUsingPOSTBodyParam, (data, error) => {
|
|
1834
|
+
try {
|
|
1835
|
+
if (stub) {
|
|
1836
|
+
const displayE = 'Error 400 received on request';
|
|
1837
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1838
|
+
} else {
|
|
1839
|
+
runCommonAsserts(data, error);
|
|
1840
|
+
}
|
|
1841
|
+
saveMockData('Sms', 'sendSmsMessageUsingPOST', 'default', data);
|
|
1842
|
+
done();
|
|
1843
|
+
} catch (err) {
|
|
1844
|
+
log.error(`Test Failure: ${err}`);
|
|
1845
|
+
done(err);
|
|
1846
|
+
}
|
|
1847
|
+
});
|
|
1848
|
+
} catch (error) {
|
|
1849
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1850
|
+
done(error);
|
|
1851
|
+
}
|
|
1852
|
+
}).timeout(attemptTimeout);
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
const smsAname = 'fakedata';
|
|
1856
|
+
describe('#getSmsMessagesUsingGET - errors', () => {
|
|
1857
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1858
|
+
try {
|
|
1859
|
+
a.getSmsMessagesUsingGET(smsAname, null, (data, error) => {
|
|
1860
|
+
try {
|
|
1861
|
+
if (stub) {
|
|
1862
|
+
const displayE = 'Error 400 received on request';
|
|
1863
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1864
|
+
} else {
|
|
1865
|
+
runCommonAsserts(data, error);
|
|
1866
|
+
}
|
|
1867
|
+
saveMockData('Sms', 'getSmsMessagesUsingGET', 'default', data);
|
|
1868
|
+
done();
|
|
1869
|
+
} catch (err) {
|
|
1870
|
+
log.error(`Test Failure: ${err}`);
|
|
1871
|
+
done(err);
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
} catch (error) {
|
|
1875
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1876
|
+
done(error);
|
|
1877
|
+
}
|
|
1878
|
+
}).timeout(attemptTimeout);
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
describe('#startSmsCallbackUsingPUT - errors', () => {
|
|
1882
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1883
|
+
try {
|
|
1884
|
+
a.startSmsCallbackUsingPUT(smsAname, (data, error) => {
|
|
1885
|
+
try {
|
|
1886
|
+
if (stub) {
|
|
1887
|
+
const displayE = 'Error 400 received on request';
|
|
1888
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1889
|
+
} else {
|
|
1890
|
+
runCommonAsserts(data, error);
|
|
1891
|
+
}
|
|
1892
|
+
saveMockData('Sms', 'startSmsCallbackUsingPUT', 'default', data);
|
|
1893
|
+
done();
|
|
1894
|
+
} catch (err) {
|
|
1895
|
+
log.error(`Test Failure: ${err}`);
|
|
1896
|
+
done(err);
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
} catch (error) {
|
|
1900
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1901
|
+
done(error);
|
|
1902
|
+
}
|
|
1903
|
+
}).timeout(attemptTimeout);
|
|
1904
|
+
});
|
|
1905
|
+
|
|
1906
|
+
const callbacksSname = 'fakedata';
|
|
1907
|
+
describe('#unregisterCallbackUsingDELETE - errors', () => {
|
|
1908
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1909
|
+
try {
|
|
1910
|
+
a.unregisterCallbackUsingDELETE(callbacksAname, callbacksSname, (data, error) => {
|
|
1911
|
+
try {
|
|
1912
|
+
if (stub) {
|
|
1913
|
+
const displayE = 'Error 400 received on request';
|
|
1914
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1915
|
+
} else {
|
|
1916
|
+
runCommonAsserts(data, error);
|
|
1917
|
+
}
|
|
1918
|
+
saveMockData('Callbacks', 'unregisterCallbackUsingDELETE', 'default', data);
|
|
1919
|
+
done();
|
|
1920
|
+
} catch (err) {
|
|
1921
|
+
log.error(`Test Failure: ${err}`);
|
|
1922
|
+
done(err);
|
|
1923
|
+
}
|
|
1924
|
+
});
|
|
1925
|
+
} catch (error) {
|
|
1926
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1927
|
+
done(error);
|
|
1928
|
+
}
|
|
1929
|
+
}).timeout(attemptTimeout);
|
|
1930
|
+
});
|
|
1931
|
+
|
|
1932
|
+
describe('#deleteDeviceGroupUsingDELETE - errors', () => {
|
|
1933
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1934
|
+
try {
|
|
1935
|
+
a.deleteDeviceGroupUsingDELETE(groupsAname, groupsGname, (data, error) => {
|
|
1936
|
+
try {
|
|
1937
|
+
if (stub) {
|
|
1938
|
+
const displayE = 'Error 400 received on request';
|
|
1939
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-thingspace-connectorRest-handleEndResponse', displayE);
|
|
1940
|
+
} else {
|
|
1941
|
+
runCommonAsserts(data, error);
|
|
1942
|
+
}
|
|
1943
|
+
saveMockData('Groups', 'deleteDeviceGroupUsingDELETE', 'default', data);
|
|
1944
|
+
done();
|
|
1945
|
+
} catch (err) {
|
|
1946
|
+
log.error(`Test Failure: ${err}`);
|
|
1947
|
+
done(err);
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1950
|
+
} catch (error) {
|
|
1951
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1952
|
+
done(error);
|
|
1953
|
+
}
|
|
1954
|
+
}).timeout(attemptTimeout);
|
|
1955
|
+
});
|
|
1956
|
+
});
|
|
1957
|
+
});
|