@itentialopensource/adapter-att_mobility 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 +206 -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 +1345 -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 +50 -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.json +53 -0
- package/entities/.system/schemaTokenResp.json +53 -0
- package/entities/Mobility/action.json +24 -0
- package/entities/Mobility/schema.json +19 -0
- package/entities/Sp/action.json +107 -0
- package/entities/Sp/schema.json +23 -0
- package/error.json +190 -0
- package/package.json +86 -0
- package/pronghorn.json +876 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1248 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/attOpenAPI.json +149 -0
- package/report/creationReport.json +255 -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 +507 -0
- package/test/unit/adapterBaseTestUnit.js +949 -0
- package/test/unit/adapterTestUnit.js +1485 -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,93 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe it context before after */
|
|
4
|
+
/* eslint no-unused-vars: warn */
|
|
5
|
+
|
|
6
|
+
const mocha = require('mocha');
|
|
7
|
+
const assert = require('assert');
|
|
8
|
+
const diagnostics = require('network-diagnostics');
|
|
9
|
+
|
|
10
|
+
let host;
|
|
11
|
+
process.argv.forEach((val) => {
|
|
12
|
+
if (val.indexOf('--HOST') === 0) {
|
|
13
|
+
[, host] = val.split('=');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('[integration] Adapter Test', () => {
|
|
18
|
+
context(`Testing network connection on ${host}`, () => {
|
|
19
|
+
before(() => {
|
|
20
|
+
diagnostics.setTestURL(host);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
after((done) => {
|
|
24
|
+
done();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('DNS resolve', (done) => {
|
|
28
|
+
diagnostics.haveDNS((result) => {
|
|
29
|
+
try {
|
|
30
|
+
assert.equal(result, true);
|
|
31
|
+
done();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
done(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('Responds to ping', (done) => {
|
|
39
|
+
diagnostics.havePing((result) => {
|
|
40
|
+
try {
|
|
41
|
+
assert.equal(result, true);
|
|
42
|
+
done();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
done(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('Support HTTP on port 80', (done) => {
|
|
50
|
+
diagnostics.haveHTTP((result) => {
|
|
51
|
+
try {
|
|
52
|
+
assert.equal(result, true);
|
|
53
|
+
done();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
done(error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('Support HTTPS on port 443', (done) => {
|
|
61
|
+
diagnostics.haveHTTPS((result) => {
|
|
62
|
+
try {
|
|
63
|
+
assert.equal(result, true);
|
|
64
|
+
done();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
done(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Support IPv4', (done) => {
|
|
72
|
+
diagnostics.haveIPv4Async((result) => {
|
|
73
|
+
try {
|
|
74
|
+
assert.equal(result, true);
|
|
75
|
+
done();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
done(error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('Support IPv6', (done) => {
|
|
83
|
+
diagnostics.haveIPv6Async((result) => {
|
|
84
|
+
try {
|
|
85
|
+
assert.equal(result, true);
|
|
86
|
+
done();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
done(error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/* eslint-disable import/no-dynamic-require */
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
5
|
+
|
|
6
|
+
// Set globals
|
|
7
|
+
/* global describe it log pronghornProps */
|
|
8
|
+
/* eslint no-unused-vars: warn */
|
|
9
|
+
/* eslint no-underscore-dangle: warn */
|
|
10
|
+
/* eslint import/no-dynamic-require:warn */
|
|
11
|
+
|
|
12
|
+
// include required items for testing & logging
|
|
13
|
+
const assert = require('assert');
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const mocha = require('mocha');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
const winston = require('winston');
|
|
18
|
+
const { expect } = require('chai');
|
|
19
|
+
const { use } = require('chai');
|
|
20
|
+
const td = require('testdouble');
|
|
21
|
+
const util = require('util');
|
|
22
|
+
|
|
23
|
+
const anything = td.matchers.anything();
|
|
24
|
+
|
|
25
|
+
// stub and attemptTimeout are used throughout the code so set them here
|
|
26
|
+
let logLevel = 'none';
|
|
27
|
+
const isRapidFail = false;
|
|
28
|
+
const isSaveMockData = false;
|
|
29
|
+
|
|
30
|
+
// read in the properties from the sampleProperties files
|
|
31
|
+
let adaptdir = __dirname;
|
|
32
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
33
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
34
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
35
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
36
|
+
}
|
|
37
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
38
|
+
|
|
39
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
40
|
+
// always check these in with bogus data!!!
|
|
41
|
+
samProps.stub = true;
|
|
42
|
+
samProps.host = 'replace.hostorip.here';
|
|
43
|
+
samProps.authentication.username = 'username';
|
|
44
|
+
samProps.authentication.password = 'password';
|
|
45
|
+
samProps.protocol = 'http';
|
|
46
|
+
samProps.port = 80;
|
|
47
|
+
samProps.ssl.enabled = false;
|
|
48
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
49
|
+
if (samProps.request.attempt_timeout < 30000) {
|
|
50
|
+
samProps.request.attempt_timeout = 30000;
|
|
51
|
+
}
|
|
52
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
53
|
+
const { stub } = samProps;
|
|
54
|
+
|
|
55
|
+
// these are the adapter properties. You generally should not need to alter
|
|
56
|
+
// any of these after they are initially set up
|
|
57
|
+
global.pronghornProps = {
|
|
58
|
+
pathProps: {
|
|
59
|
+
encrypted: false
|
|
60
|
+
},
|
|
61
|
+
adapterProps: {
|
|
62
|
+
adapters: [{
|
|
63
|
+
id: 'Test-attmobility',
|
|
64
|
+
type: 'Attmobility',
|
|
65
|
+
properties: samProps
|
|
66
|
+
}]
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
global.$HOME = `${__dirname}/../..`;
|
|
71
|
+
|
|
72
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
73
|
+
// this you may error on log.trace calls.
|
|
74
|
+
const myCustomLevels = {
|
|
75
|
+
levels: {
|
|
76
|
+
spam: 6,
|
|
77
|
+
trace: 5,
|
|
78
|
+
debug: 4,
|
|
79
|
+
info: 3,
|
|
80
|
+
warn: 2,
|
|
81
|
+
error: 1,
|
|
82
|
+
none: 0
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// need to see if there is a log level passed in
|
|
87
|
+
process.argv.forEach((val) => {
|
|
88
|
+
// is there a log level defined to be passed in?
|
|
89
|
+
if (val.indexOf('--LOG') === 0) {
|
|
90
|
+
// get the desired log level
|
|
91
|
+
const inputVal = val.split('=')[1];
|
|
92
|
+
|
|
93
|
+
// validate the log level is supported, if so set it
|
|
94
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
95
|
+
logLevel = inputVal;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// need to set global logging
|
|
101
|
+
global.log = winston.createLogger({
|
|
102
|
+
level: logLevel,
|
|
103
|
+
levels: myCustomLevels.levels,
|
|
104
|
+
transports: [
|
|
105
|
+
new winston.transports.Console()
|
|
106
|
+
]
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Runs the common asserts for test
|
|
111
|
+
*/
|
|
112
|
+
function runCommonAsserts(data, error) {
|
|
113
|
+
assert.equal(undefined, error);
|
|
114
|
+
assert.notEqual(undefined, data);
|
|
115
|
+
assert.notEqual(null, data);
|
|
116
|
+
assert.notEqual(undefined, data.response);
|
|
117
|
+
assert.notEqual(null, data.response);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Runs the error asserts for the test
|
|
122
|
+
*/
|
|
123
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
124
|
+
assert.equal(null, data);
|
|
125
|
+
assert.notEqual(undefined, error);
|
|
126
|
+
assert.notEqual(null, error);
|
|
127
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
128
|
+
assert.notEqual(null, error.IAPerror);
|
|
129
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
130
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
131
|
+
assert.equal(code, error.icode);
|
|
132
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
133
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @function saveMockData
|
|
138
|
+
* Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
|
|
139
|
+
* Note, this was built based on entity file structure for Adapter-Engine 1.6.x
|
|
140
|
+
* @param {string} entityName - Name of the entity saving mock data for
|
|
141
|
+
* @param {string} actionName - Name of the action saving mock data for
|
|
142
|
+
* @param {string} descriptor - Something to describe this test (used as a type)
|
|
143
|
+
* @param {string or object} responseData - The data to put in the mock file.
|
|
144
|
+
*/
|
|
145
|
+
function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
146
|
+
// do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
|
|
147
|
+
if (stub || !isSaveMockData) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// must have a response in order to store the response
|
|
152
|
+
if (responseData && responseData.response) {
|
|
153
|
+
let data = responseData.response;
|
|
154
|
+
|
|
155
|
+
// if there was a raw response that one is better as it is untranslated
|
|
156
|
+
if (responseData.raw) {
|
|
157
|
+
data = responseData.raw;
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
const temp = JSON.parse(data);
|
|
161
|
+
data = temp;
|
|
162
|
+
} catch (pex) {
|
|
163
|
+
// do not care if it did not parse as we will just use data
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
const base = path.join(__dirname, `../../entities/${entityName}/`);
|
|
169
|
+
const mockdatafolder = 'mockdatafiles';
|
|
170
|
+
const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
|
|
171
|
+
|
|
172
|
+
if (!fs.existsSync(base + mockdatafolder)) {
|
|
173
|
+
fs.mkdirSync(base + mockdatafolder);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// write the data we retrieved
|
|
177
|
+
fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
|
|
178
|
+
if (errWritingMock) throw errWritingMock;
|
|
179
|
+
|
|
180
|
+
// update the action file to reflect the changes. Note: We're replacing the default object for now!
|
|
181
|
+
fs.readFile(`${base}action.json`, (errRead, content) => {
|
|
182
|
+
if (errRead) throw errRead;
|
|
183
|
+
|
|
184
|
+
// parse the action file into JSON
|
|
185
|
+
const parsedJson = JSON.parse(content);
|
|
186
|
+
|
|
187
|
+
// The object update we'll write in.
|
|
188
|
+
const responseObj = {
|
|
189
|
+
type: descriptor,
|
|
190
|
+
key: '',
|
|
191
|
+
mockFile: filename
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// get the object for method we're trying to change.
|
|
195
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
196
|
+
|
|
197
|
+
// if the method was not found - should never happen but...
|
|
198
|
+
if (!currentMethodAction) {
|
|
199
|
+
throw Error('Can\'t find an action for this method in the provided entity.');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
203
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
204
|
+
|
|
205
|
+
// Add the action responseObj back into the array of response objects.
|
|
206
|
+
if (!actionResponseObj) {
|
|
207
|
+
// if there is a default response object, we want to get the key.
|
|
208
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
209
|
+
|
|
210
|
+
// save the default key into the new response object
|
|
211
|
+
if (defaultResponseObj) {
|
|
212
|
+
responseObj.key = defaultResponseObj.key;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// save the new response object
|
|
216
|
+
currentMethodAction.responseObjects = [responseObj];
|
|
217
|
+
} else {
|
|
218
|
+
// update the location of the mock data file
|
|
219
|
+
actionResponseObj.mockFile = responseObj.mockFile;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Save results
|
|
223
|
+
fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
|
|
224
|
+
if (err) throw err;
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
} catch (e) {
|
|
229
|
+
log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// no response to save
|
|
235
|
+
log.debug(`No data passed to save into mockdata for ${actionName}`);
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// require the adapter that we are going to be using
|
|
240
|
+
const Attmobility = require('../../adapter');
|
|
241
|
+
|
|
242
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
243
|
+
describe('[integration] Attmobility Adapter Test', () => {
|
|
244
|
+
describe('Attmobility Class Tests', () => {
|
|
245
|
+
const a = new Attmobility(
|
|
246
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
247
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
if (isRapidFail) {
|
|
251
|
+
const state = {};
|
|
252
|
+
state.passed = true;
|
|
253
|
+
|
|
254
|
+
mocha.afterEach(function x() {
|
|
255
|
+
state.passed = state.passed
|
|
256
|
+
&& (this.currentTest.state === 'passed');
|
|
257
|
+
});
|
|
258
|
+
mocha.beforeEach(function x() {
|
|
259
|
+
if (!state.passed) {
|
|
260
|
+
return this.currentTest.skip();
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
describe('#class instance created', () => {
|
|
267
|
+
it('should be a class with properties', (done) => {
|
|
268
|
+
try {
|
|
269
|
+
assert.notEqual(null, a);
|
|
270
|
+
assert.notEqual(undefined, a);
|
|
271
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
272
|
+
assert.equal(checkId, a.id);
|
|
273
|
+
assert.notEqual(null, a.allProps);
|
|
274
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
275
|
+
assert.equal(check, a.healthcheckType);
|
|
276
|
+
done();
|
|
277
|
+
} catch (error) {
|
|
278
|
+
log.error(`Test Failure: ${error}`);
|
|
279
|
+
done(error);
|
|
280
|
+
}
|
|
281
|
+
}).timeout(attemptTimeout);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
describe('#connect', () => {
|
|
285
|
+
it('should get connected - no healthcheck', (done) => {
|
|
286
|
+
try {
|
|
287
|
+
a.healthcheckType = 'none';
|
|
288
|
+
a.connect();
|
|
289
|
+
|
|
290
|
+
try {
|
|
291
|
+
assert.equal(true, a.alive);
|
|
292
|
+
done();
|
|
293
|
+
} catch (error) {
|
|
294
|
+
log.error(`Test Failure: ${error}`);
|
|
295
|
+
done(error);
|
|
296
|
+
}
|
|
297
|
+
} catch (error) {
|
|
298
|
+
log.error(`Adapter Exception: ${error}`);
|
|
299
|
+
done(error);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
it('should get connected - startup healthcheck', (done) => {
|
|
303
|
+
try {
|
|
304
|
+
a.healthcheckType = 'startup';
|
|
305
|
+
a.connect();
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
assert.equal(true, a.alive);
|
|
309
|
+
done();
|
|
310
|
+
} catch (error) {
|
|
311
|
+
log.error(`Test Failure: ${error}`);
|
|
312
|
+
done(error);
|
|
313
|
+
}
|
|
314
|
+
} catch (error) {
|
|
315
|
+
log.error(`Adapter Exception: ${error}`);
|
|
316
|
+
done(error);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
describe('#healthCheck', () => {
|
|
322
|
+
it('should be healthy', (done) => {
|
|
323
|
+
try {
|
|
324
|
+
a.healthCheck(null, (data) => {
|
|
325
|
+
try {
|
|
326
|
+
assert.equal(true, a.healthy);
|
|
327
|
+
saveMockData('system', 'healthcheck', 'default', data);
|
|
328
|
+
done();
|
|
329
|
+
} catch (err) {
|
|
330
|
+
log.error(`Test Failure: ${err}`);
|
|
331
|
+
done(err);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
} catch (error) {
|
|
335
|
+
log.error(`Adapter Exception: ${error}`);
|
|
336
|
+
done(error);
|
|
337
|
+
}
|
|
338
|
+
}).timeout(attemptTimeout);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
/*
|
|
342
|
+
-----------------------------------------------------------------------
|
|
343
|
+
-----------------------------------------------------------------------
|
|
344
|
+
*** All code above this comment will be replaced during a migration ***
|
|
345
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
346
|
+
-----------------------------------------------------------------------
|
|
347
|
+
-----------------------------------------------------------------------
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
const spPostServiceActivationBodyParam = {};
|
|
351
|
+
describe('#postServiceActivation - errors', () => {
|
|
352
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
353
|
+
try {
|
|
354
|
+
a.postServiceActivation(spPostServiceActivationBodyParam, (data, error) => {
|
|
355
|
+
try {
|
|
356
|
+
if (stub) {
|
|
357
|
+
const displayE = 'Error 400 received on request';
|
|
358
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
359
|
+
} else {
|
|
360
|
+
runCommonAsserts(data, error);
|
|
361
|
+
}
|
|
362
|
+
saveMockData('Sp', 'postServiceActivation', 'default', data);
|
|
363
|
+
done();
|
|
364
|
+
} catch (err) {
|
|
365
|
+
log.error(`Test Failure: ${err}`);
|
|
366
|
+
done(err);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
} catch (error) {
|
|
370
|
+
log.error(`Adapter Exception: ${error}`);
|
|
371
|
+
done(error);
|
|
372
|
+
}
|
|
373
|
+
}).timeout(attemptTimeout);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
const spBillingAccountNumber = 'fakedata';
|
|
377
|
+
describe('#getBillingAccountDetails - errors', () => {
|
|
378
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
379
|
+
try {
|
|
380
|
+
a.getBillingAccountDetails(spBillingAccountNumber, (data, error) => {
|
|
381
|
+
try {
|
|
382
|
+
if (stub) {
|
|
383
|
+
const displayE = 'Error 400 received on request';
|
|
384
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
385
|
+
} else {
|
|
386
|
+
runCommonAsserts(data, error);
|
|
387
|
+
}
|
|
388
|
+
saveMockData('Sp', 'getBillingAccountDetails', 'default', data);
|
|
389
|
+
done();
|
|
390
|
+
} catch (err) {
|
|
391
|
+
log.error(`Test Failure: ${err}`);
|
|
392
|
+
done(err);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
} catch (error) {
|
|
396
|
+
log.error(`Adapter Exception: ${error}`);
|
|
397
|
+
done(error);
|
|
398
|
+
}
|
|
399
|
+
}).timeout(attemptTimeout);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
const spSubsciberLine = 'fakedata';
|
|
403
|
+
const spEditSubscriberLineDetailsBodyParam = {};
|
|
404
|
+
describe('#editSubscriberLineDetails - errors', () => {
|
|
405
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
406
|
+
try {
|
|
407
|
+
a.editSubscriberLineDetails(spSubsciberLine, spEditSubscriberLineDetailsBodyParam, (data, error) => {
|
|
408
|
+
try {
|
|
409
|
+
if (stub) {
|
|
410
|
+
const displayE = 'Error 400 received on request';
|
|
411
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
412
|
+
} else {
|
|
413
|
+
runCommonAsserts(data, error);
|
|
414
|
+
}
|
|
415
|
+
saveMockData('Sp', 'editSubscriberLineDetails', 'default', data);
|
|
416
|
+
done();
|
|
417
|
+
} catch (err) {
|
|
418
|
+
log.error(`Test Failure: ${err}`);
|
|
419
|
+
done(err);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
} catch (error) {
|
|
423
|
+
log.error(`Adapter Exception: ${error}`);
|
|
424
|
+
done(error);
|
|
425
|
+
}
|
|
426
|
+
}).timeout(attemptTimeout);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
const spSubscriberLine = 'fakedata';
|
|
430
|
+
describe('#getSubscriberLineDetails - errors', () => {
|
|
431
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
432
|
+
try {
|
|
433
|
+
a.getSubscriberLineDetails(spSubscriberLine, (data, error) => {
|
|
434
|
+
try {
|
|
435
|
+
if (stub) {
|
|
436
|
+
const displayE = 'Error 400 received on request';
|
|
437
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
438
|
+
} else {
|
|
439
|
+
runCommonAsserts(data, error);
|
|
440
|
+
}
|
|
441
|
+
saveMockData('Sp', 'getSubscriberLineDetails', 'default', data);
|
|
442
|
+
done();
|
|
443
|
+
} catch (err) {
|
|
444
|
+
log.error(`Test Failure: ${err}`);
|
|
445
|
+
done(err);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
} catch (error) {
|
|
449
|
+
log.error(`Adapter Exception: ${error}`);
|
|
450
|
+
done(error);
|
|
451
|
+
}
|
|
452
|
+
}).timeout(attemptTimeout);
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
const spRequestId = 'fakedata';
|
|
456
|
+
describe('#getServiceActivationStatus - errors', () => {
|
|
457
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
458
|
+
try {
|
|
459
|
+
a.getServiceActivationStatus(spRequestId, (data, error) => {
|
|
460
|
+
try {
|
|
461
|
+
if (stub) {
|
|
462
|
+
const displayE = 'Error 400 received on request';
|
|
463
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
464
|
+
} else {
|
|
465
|
+
runCommonAsserts(data, error);
|
|
466
|
+
}
|
|
467
|
+
saveMockData('Sp', 'getServiceActivationStatus', 'default', data);
|
|
468
|
+
done();
|
|
469
|
+
} catch (err) {
|
|
470
|
+
log.error(`Test Failure: ${err}`);
|
|
471
|
+
done(err);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
} catch (error) {
|
|
475
|
+
log.error(`Adapter Exception: ${error}`);
|
|
476
|
+
done(error);
|
|
477
|
+
}
|
|
478
|
+
}).timeout(attemptTimeout);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
const spImeiNumber = 'fakedata';
|
|
482
|
+
describe('#queryDeviceByIMEI - errors', () => {
|
|
483
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
484
|
+
try {
|
|
485
|
+
a.queryDeviceByIMEI(spImeiNumber, (data, error) => {
|
|
486
|
+
try {
|
|
487
|
+
if (stub) {
|
|
488
|
+
const displayE = 'Error 400 received on request';
|
|
489
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-attmobility-connectorRest-handleEndResponse', displayE);
|
|
490
|
+
} else {
|
|
491
|
+
runCommonAsserts(data, error);
|
|
492
|
+
}
|
|
493
|
+
saveMockData('Mobility', 'queryDeviceByIMEI', 'default', data);
|
|
494
|
+
done();
|
|
495
|
+
} catch (err) {
|
|
496
|
+
log.error(`Test Failure: ${err}`);
|
|
497
|
+
done(err);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
} catch (error) {
|
|
501
|
+
log.error(`Adapter Exception: ${error}`);
|
|
502
|
+
done(error);
|
|
503
|
+
}
|
|
504
|
+
}).timeout(attemptTimeout);
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
});
|