@itentialopensource/adapter-gogetssl 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 +5 -0
- package/.eslintrc.js +18 -0
- package/.jshintrc +3 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +48 -0
- package/CONTRIBUTING.md +158 -0
- package/LICENSE +201 -0
- package/README.md +687 -0
- package/adapter.js +5428 -0
- package/adapterBase.js +1028 -0
- package/entities/.generic/action.json +109 -0
- package/entities/.generic/schema.json +23 -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/Account/action.json +46 -0
- package/entities/Account/mockdatafiles/getAccountBalance-default.json +5 -0
- package/entities/Account/mockdatafiles/getAccountDetails-default.json +18 -0
- package/entities/Account/schema.json +31 -0
- package/entities/CSR/action.json +64 -0
- package/entities/CSR/mockdatafiles/decodeCSR-default.json +6 -0
- package/entities/CSR/mockdatafiles/generateCSR-default.json +5 -0
- package/entities/CSR/schema.json +98 -0
- package/entities/DCV/action.json +84 -0
- package/entities/DCV/mockdatafiles/domainGetFromWhois-default.json +5 -0
- package/entities/DCV/mockdatafiles/getDomainAlternative-default.json +24 -0
- package/entities/DCV/mockdatafiles/getDomainEmails-default.json +5 -0
- package/entities/DCV/mockdatafiles/getDomainEmailsForGeotrust-default.json +10 -0
- package/entities/DCV/schema.json +33 -0
- package/entities/Invoices/action.json +67 -0
- package/entities/Invoices/mockdatafiles/getAllInvoices-default.json +27 -0
- package/entities/Invoices/mockdatafiles/getOrderInvoice-default.json +13 -0
- package/entities/Invoices/mockdatafiles/getUnpaidInvoices-default.json +60 -0
- package/entities/Invoices/schema.json +43 -0
- package/entities/LEI/action.json +127 -0
- package/entities/LEI/mockdatafiles/createNewLEI-default.json +13 -0
- package/entities/LEI/mockdatafiles/getLeiStatus-default.json +5 -0
- package/entities/LEI/schema.json +46 -0
- package/entities/Orders/action.json +249 -0
- package/entities/Orders/mockdatafiles/addSSLOrder-default.json +59 -0
- package/entities/Orders/mockdatafiles/addSSLSANOrder-default.json +10 -0
- package/entities/Orders/mockdatafiles/cancelOrder-default.json +4 -0
- package/entities/Orders/mockdatafiles/comodoClaimFreeEV-default.json +5 -0
- package/entities/Orders/mockdatafiles/getAllSSLOrders-default.json +40 -0
- package/entities/Orders/mockdatafiles/getOrderStatus-default.json +105 -0
- package/entities/Orders/mockdatafiles/getOrdersStatuses-default.json +32 -0
- package/entities/Orders/mockdatafiles/getTotalOrders-default.json +4 -0
- package/entities/Orders/mockdatafiles/getUnpaidOrders-default.json +131 -0
- package/entities/Orders/mockdatafiles/recheckCAA-default.json +5 -0
- package/entities/Orders/schema.json +459 -0
- package/entities/Products/action.json +151 -0
- package/entities/Products/mockdatafiles/getAllProductPrices-default.json +10 -0
- package/entities/Products/mockdatafiles/getAllProducts-default.json +110 -0
- package/entities/Products/mockdatafiles/getProductAgreement-default.json +5 -0
- package/entities/Products/mockdatafiles/getProductPrice-default.json +50 -0
- package/entities/Products/mockdatafiles/getSslProduct-default.json +29 -0
- package/entities/Products/mockdatafiles/getSslProducts-default.json +325 -0
- package/entities/Products/schema.json +47 -0
- package/entities/Validation/action.json +145 -0
- package/entities/Validation/mockdatafiles/changeDcv-default.json +12 -0
- package/entities/Validation/mockdatafiles/changeDomainsValidationMethod-default.json +4 -0
- package/entities/Validation/mockdatafiles/resend-default.json +5 -0
- package/entities/Validation/mockdatafiles/resendValidationEmail-default.json +5 -0
- package/entities/Validation/mockdatafiles/revalidate-default.json +5 -0
- package/entities/Validation/schema.json +91 -0
- package/entities/Webservers/action.json +25 -0
- package/entities/Webservers/mockdatafiles/getWebServers-default.json +149 -0
- package/entities/Webservers/schema.json +41 -0
- package/error.json +184 -0
- package/package.json +83 -0
- package/pronghorn.json +8799 -0
- package/propertiesSchema.json +840 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/creationReport.json +339 -0
- package/report/gogetssl_apimatic_openapi3.json +21135 -0
- package/sampleProperties.json +106 -0
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +1746 -0
- package/test/unit/adapterBaseTestUnit.js +944 -0
- package/test/unit/adapterTestUnit.js +4765 -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 +224 -0
- package/utils/findPath.js +74 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/pre-commit.sh +27 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +445 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +190 -0
- package/workflows/README.md +3 -0
|
@@ -0,0 +1,1746 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
// Set globals
|
|
4
|
+
/* global describe it log pronghornProps */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
|
|
7
|
+
// include required items for testing & logging
|
|
8
|
+
const assert = require('assert');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const mocha = require('mocha');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const winston = require('winston');
|
|
13
|
+
const { expect } = require('chai');
|
|
14
|
+
const { use } = require('chai');
|
|
15
|
+
const td = require('testdouble');
|
|
16
|
+
|
|
17
|
+
const anything = td.matchers.anything();
|
|
18
|
+
|
|
19
|
+
// stub and attemptTimeout are used throughout the code so set them here
|
|
20
|
+
let logLevel = 'none';
|
|
21
|
+
const stub = true;
|
|
22
|
+
const isRapidFail = false;
|
|
23
|
+
const isSaveMockData = false;
|
|
24
|
+
const attemptTimeout = 5000;
|
|
25
|
+
|
|
26
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
27
|
+
// always check these in with bogus data!!!
|
|
28
|
+
const host = 'replace.hostorip.here';
|
|
29
|
+
const username = 'username';
|
|
30
|
+
const password = 'password';
|
|
31
|
+
const protocol = 'http';
|
|
32
|
+
const port = 80;
|
|
33
|
+
const sslenable = false;
|
|
34
|
+
const sslinvalid = false;
|
|
35
|
+
|
|
36
|
+
// these are the adapter properties. You generally should not need to alter
|
|
37
|
+
// any of these after they are initially set up
|
|
38
|
+
global.pronghornProps = {
|
|
39
|
+
pathProps: {
|
|
40
|
+
encrypted: false
|
|
41
|
+
},
|
|
42
|
+
adapterProps: {
|
|
43
|
+
adapters: [{
|
|
44
|
+
id: 'Test-GoGetSSL',
|
|
45
|
+
type: 'GoGetSSL',
|
|
46
|
+
properties: {
|
|
47
|
+
host,
|
|
48
|
+
port,
|
|
49
|
+
base_path: '/',
|
|
50
|
+
version: '',
|
|
51
|
+
cache_location: 'none',
|
|
52
|
+
encode_pathvars: true,
|
|
53
|
+
save_metric: false,
|
|
54
|
+
stub,
|
|
55
|
+
protocol,
|
|
56
|
+
authentication: {
|
|
57
|
+
auth_method: 'no_authentication',
|
|
58
|
+
username,
|
|
59
|
+
password,
|
|
60
|
+
token: '',
|
|
61
|
+
invalid_token_error: 401,
|
|
62
|
+
token_timeout: -1,
|
|
63
|
+
token_cache: 'local',
|
|
64
|
+
auth_field: 'header.headers.Authorization',
|
|
65
|
+
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
66
|
+
auth_logging: false,
|
|
67
|
+
client_id: '',
|
|
68
|
+
client_secret: '',
|
|
69
|
+
grant_type: ''
|
|
70
|
+
},
|
|
71
|
+
healthcheck: {
|
|
72
|
+
type: 'none',
|
|
73
|
+
frequency: 60000,
|
|
74
|
+
query_object: {}
|
|
75
|
+
},
|
|
76
|
+
throttle: {
|
|
77
|
+
throttle_enabled: false,
|
|
78
|
+
number_pronghorns: 1,
|
|
79
|
+
sync_async: 'sync',
|
|
80
|
+
max_in_queue: 1000,
|
|
81
|
+
concurrent_max: 1,
|
|
82
|
+
expire_timeout: 0,
|
|
83
|
+
avg_runtime: 200,
|
|
84
|
+
priorities: [
|
|
85
|
+
{
|
|
86
|
+
value: 0,
|
|
87
|
+
percent: 100
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
request: {
|
|
92
|
+
number_redirects: 0,
|
|
93
|
+
number_retries: 3,
|
|
94
|
+
limit_retry_error: [0],
|
|
95
|
+
failover_codes: [],
|
|
96
|
+
attempt_timeout: attemptTimeout,
|
|
97
|
+
global_request: {
|
|
98
|
+
payload: {},
|
|
99
|
+
uriOptions: {},
|
|
100
|
+
addlHeaders: {},
|
|
101
|
+
authData: {}
|
|
102
|
+
},
|
|
103
|
+
healthcheck_on_timeout: true,
|
|
104
|
+
return_raw: true,
|
|
105
|
+
archiving: false,
|
|
106
|
+
return_request: false
|
|
107
|
+
},
|
|
108
|
+
proxy: {
|
|
109
|
+
enabled: false,
|
|
110
|
+
host: '',
|
|
111
|
+
port: 1,
|
|
112
|
+
protocol: 'http',
|
|
113
|
+
username: '',
|
|
114
|
+
password: ''
|
|
115
|
+
},
|
|
116
|
+
ssl: {
|
|
117
|
+
ecdhCurve: '',
|
|
118
|
+
enabled: sslenable,
|
|
119
|
+
accept_invalid_cert: sslinvalid,
|
|
120
|
+
ca_file: '',
|
|
121
|
+
key_file: '',
|
|
122
|
+
cert_file: '',
|
|
123
|
+
secure_protocol: '',
|
|
124
|
+
ciphers: ''
|
|
125
|
+
},
|
|
126
|
+
mongo: {
|
|
127
|
+
host: '',
|
|
128
|
+
port: 0,
|
|
129
|
+
database: '',
|
|
130
|
+
username: '',
|
|
131
|
+
password: '',
|
|
132
|
+
replSet: '',
|
|
133
|
+
db_ssl: {
|
|
134
|
+
enabled: false,
|
|
135
|
+
accept_invalid_cert: false,
|
|
136
|
+
ca_file: '',
|
|
137
|
+
key_file: '',
|
|
138
|
+
cert_file: ''
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}]
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
global.$HOME = `${__dirname}/../..`;
|
|
147
|
+
|
|
148
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
149
|
+
// this you may error on log.trace calls.
|
|
150
|
+
const myCustomLevels = {
|
|
151
|
+
levels: {
|
|
152
|
+
spam: 6,
|
|
153
|
+
trace: 5,
|
|
154
|
+
debug: 4,
|
|
155
|
+
info: 3,
|
|
156
|
+
warn: 2,
|
|
157
|
+
error: 1,
|
|
158
|
+
none: 0
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// need to see if there is a log level passed in
|
|
163
|
+
process.argv.forEach((val) => {
|
|
164
|
+
// is there a log level defined to be passed in?
|
|
165
|
+
if (val.indexOf('--LOG') === 0) {
|
|
166
|
+
// get the desired log level
|
|
167
|
+
const inputVal = val.split('=')[1];
|
|
168
|
+
|
|
169
|
+
// validate the log level is supported, if so set it
|
|
170
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
171
|
+
logLevel = inputVal;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// need to set global logging
|
|
177
|
+
global.log = winston.createLogger({
|
|
178
|
+
level: logLevel,
|
|
179
|
+
levels: myCustomLevels.levels,
|
|
180
|
+
transports: [
|
|
181
|
+
new winston.transports.Console()
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Runs the common asserts for test
|
|
187
|
+
*/
|
|
188
|
+
function runCommonAsserts(data, error) {
|
|
189
|
+
assert.equal(undefined, error);
|
|
190
|
+
assert.notEqual(undefined, data);
|
|
191
|
+
assert.notEqual(null, data);
|
|
192
|
+
assert.notEqual(undefined, data.response);
|
|
193
|
+
assert.notEqual(null, data.response);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Runs the error asserts for the test
|
|
198
|
+
*/
|
|
199
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
200
|
+
assert.equal(null, data);
|
|
201
|
+
assert.notEqual(undefined, error);
|
|
202
|
+
assert.notEqual(null, error);
|
|
203
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
204
|
+
assert.notEqual(null, error.IAPerror);
|
|
205
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
206
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
207
|
+
assert.equal(code, error.icode);
|
|
208
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
209
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @function saveMockData
|
|
214
|
+
* Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
|
|
215
|
+
* Note, this was built based on entity file structure for Adapter-Engine 1.6.x
|
|
216
|
+
* @param {string} entityName - Name of the entity saving mock data for
|
|
217
|
+
* @param {string} actionName - Name of the action saving mock data for
|
|
218
|
+
* @param {string} descriptor - Something to describe this test (used as a type)
|
|
219
|
+
* @param {string or object} responseData - The data to put in the mock file.
|
|
220
|
+
*/
|
|
221
|
+
function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
222
|
+
// do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
|
|
223
|
+
if (stub || !isSaveMockData) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// must have a response in order to store the response
|
|
228
|
+
if (responseData && responseData.response) {
|
|
229
|
+
let data = responseData.response;
|
|
230
|
+
|
|
231
|
+
// if there was a raw response that one is better as it is untranslated
|
|
232
|
+
if (responseData.raw) {
|
|
233
|
+
data = responseData.raw;
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
const temp = JSON.parse(data);
|
|
237
|
+
data = temp;
|
|
238
|
+
} catch (pex) {
|
|
239
|
+
// do not care if it did not parse as we will just use data
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
try {
|
|
244
|
+
const base = path.join(__dirname, `../../entities/${entityName}/`);
|
|
245
|
+
const mockdatafolder = 'mockdatafiles';
|
|
246
|
+
const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
|
|
247
|
+
|
|
248
|
+
if (!fs.existsSync(base + mockdatafolder)) {
|
|
249
|
+
fs.mkdirSync(base + mockdatafolder);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// write the data we retrieved
|
|
253
|
+
fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
|
|
254
|
+
if (errWritingMock) throw errWritingMock;
|
|
255
|
+
|
|
256
|
+
// update the action file to reflect the changes. Note: We're replacing the default object for now!
|
|
257
|
+
fs.readFile(`${base}action.json`, (errRead, content) => {
|
|
258
|
+
if (errRead) throw errRead;
|
|
259
|
+
|
|
260
|
+
// parse the action file into JSON
|
|
261
|
+
const parsedJson = JSON.parse(content);
|
|
262
|
+
|
|
263
|
+
// The object update we'll write in.
|
|
264
|
+
const responseObj = {
|
|
265
|
+
type: descriptor,
|
|
266
|
+
key: '',
|
|
267
|
+
mockFile: filename
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
// get the object for method we're trying to change.
|
|
271
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
272
|
+
|
|
273
|
+
// if the method was not found - should never happen but...
|
|
274
|
+
if (!currentMethodAction) {
|
|
275
|
+
throw Error('Can\'t find an action for this method in the provided entity.');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
279
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
280
|
+
|
|
281
|
+
// Add the action responseObj back into the array of response objects.
|
|
282
|
+
if (!actionResponseObj) {
|
|
283
|
+
// if there is a default response object, we want to get the key.
|
|
284
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
285
|
+
|
|
286
|
+
// save the default key into the new response object
|
|
287
|
+
if (defaultResponseObj) {
|
|
288
|
+
responseObj.key = defaultResponseObj.key;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// save the new response object
|
|
292
|
+
currentMethodAction.responseObjects = [responseObj];
|
|
293
|
+
} else {
|
|
294
|
+
// update the location of the mock data file
|
|
295
|
+
actionResponseObj.mockFile = responseObj.mockFile;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Save results
|
|
299
|
+
fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
|
|
300
|
+
if (err) throw err;
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
} catch (e) {
|
|
305
|
+
log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// no response to save
|
|
311
|
+
log.debug(`No data passed to save into mockdata for ${actionName}`);
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// require the adapter that we are going to be using
|
|
316
|
+
const GoGetSSL = require('../../adapter');
|
|
317
|
+
|
|
318
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
319
|
+
describe('[integration] GoGetSSL Adapter Test', () => {
|
|
320
|
+
describe('GoGetSSL Class Tests', () => {
|
|
321
|
+
const a = new GoGetSSL(
|
|
322
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
323
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
if (isRapidFail) {
|
|
327
|
+
const state = {};
|
|
328
|
+
state.passed = true;
|
|
329
|
+
|
|
330
|
+
mocha.afterEach(function x() {
|
|
331
|
+
state.passed = state.passed
|
|
332
|
+
&& (this.currentTest.state === 'passed');
|
|
333
|
+
});
|
|
334
|
+
mocha.beforeEach(function x() {
|
|
335
|
+
if (!state.passed) {
|
|
336
|
+
return this.currentTest.skip();
|
|
337
|
+
}
|
|
338
|
+
return true;
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
describe('#class instance created', () => {
|
|
343
|
+
it('should be a class with properties', (done) => {
|
|
344
|
+
try {
|
|
345
|
+
assert.notEqual(null, a);
|
|
346
|
+
assert.notEqual(undefined, a);
|
|
347
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
348
|
+
assert.equal(checkId, a.id);
|
|
349
|
+
assert.notEqual(null, a.allProps);
|
|
350
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
351
|
+
assert.equal(check, a.healthcheckType);
|
|
352
|
+
done();
|
|
353
|
+
} catch (error) {
|
|
354
|
+
log.error(`Test Failure: ${error}`);
|
|
355
|
+
done(error);
|
|
356
|
+
}
|
|
357
|
+
}).timeout(attemptTimeout);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
describe('#connect', () => {
|
|
361
|
+
it('should get connected - no healthcheck', (done) => {
|
|
362
|
+
try {
|
|
363
|
+
a.healthcheckType = 'none';
|
|
364
|
+
a.connect();
|
|
365
|
+
|
|
366
|
+
try {
|
|
367
|
+
assert.equal(true, a.alive);
|
|
368
|
+
done();
|
|
369
|
+
} catch (error) {
|
|
370
|
+
log.error(`Test Failure: ${error}`);
|
|
371
|
+
done(error);
|
|
372
|
+
}
|
|
373
|
+
} catch (error) {
|
|
374
|
+
log.error(`Adapter Exception: ${error}`);
|
|
375
|
+
done(error);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
it('should get connected - startup healthcheck', (done) => {
|
|
379
|
+
try {
|
|
380
|
+
a.healthcheckType = 'startup';
|
|
381
|
+
a.connect();
|
|
382
|
+
|
|
383
|
+
try {
|
|
384
|
+
assert.equal(true, a.alive);
|
|
385
|
+
done();
|
|
386
|
+
} catch (error) {
|
|
387
|
+
log.error(`Test Failure: ${error}`);
|
|
388
|
+
done(error);
|
|
389
|
+
}
|
|
390
|
+
} catch (error) {
|
|
391
|
+
log.error(`Adapter Exception: ${error}`);
|
|
392
|
+
done(error);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
describe('#healthCheck', () => {
|
|
398
|
+
it('should be healthy', (done) => {
|
|
399
|
+
try {
|
|
400
|
+
a.healthCheck(null, (data) => {
|
|
401
|
+
try {
|
|
402
|
+
assert.equal(true, a.healthy);
|
|
403
|
+
saveMockData('system', 'healthcheck', 'default', data);
|
|
404
|
+
done();
|
|
405
|
+
} catch (err) {
|
|
406
|
+
log.error(`Test Failure: ${err}`);
|
|
407
|
+
done(err);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
} catch (error) {
|
|
411
|
+
log.error(`Adapter Exception: ${error}`);
|
|
412
|
+
done(error);
|
|
413
|
+
}
|
|
414
|
+
}).timeout(attemptTimeout);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
/*
|
|
418
|
+
-----------------------------------------------------------------------
|
|
419
|
+
-----------------------------------------------------------------------
|
|
420
|
+
*** All code above this comment will be replaced during a migration ***
|
|
421
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
422
|
+
-----------------------------------------------------------------------
|
|
423
|
+
-----------------------------------------------------------------------
|
|
424
|
+
*/
|
|
425
|
+
|
|
426
|
+
const productsAuthKey = 'fakedata';
|
|
427
|
+
describe('#getAllProducts - errors', () => {
|
|
428
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
429
|
+
try {
|
|
430
|
+
a.getAllProducts(productsAuthKey, (data, error) => {
|
|
431
|
+
try {
|
|
432
|
+
if (stub) {
|
|
433
|
+
runCommonAsserts(data, error);
|
|
434
|
+
assert.equal(true, Array.isArray(data.response.products));
|
|
435
|
+
assert.equal(false, data.response.success);
|
|
436
|
+
} else {
|
|
437
|
+
runCommonAsserts(data, error);
|
|
438
|
+
}
|
|
439
|
+
saveMockData('Products', 'getAllProducts', 'default', data);
|
|
440
|
+
done();
|
|
441
|
+
} catch (err) {
|
|
442
|
+
log.error(`Test Failure: ${err}`);
|
|
443
|
+
done(err);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
} catch (error) {
|
|
447
|
+
log.error(`Adapter Exception: ${error}`);
|
|
448
|
+
done(error);
|
|
449
|
+
}
|
|
450
|
+
}).timeout(attemptTimeout);
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
describe('#getProductAgreement - errors', () => {
|
|
454
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
455
|
+
try {
|
|
456
|
+
a.getProductAgreement(productsAuthKey, 'fakedata', (data, error) => {
|
|
457
|
+
try {
|
|
458
|
+
if (stub) {
|
|
459
|
+
runCommonAsserts(data, error);
|
|
460
|
+
assert.equal('66', data.response.productId);
|
|
461
|
+
assert.equal(true, data.response.success);
|
|
462
|
+
} else {
|
|
463
|
+
runCommonAsserts(data, error);
|
|
464
|
+
}
|
|
465
|
+
saveMockData('Products', 'getProductAgreement', 'default', data);
|
|
466
|
+
done();
|
|
467
|
+
} catch (err) {
|
|
468
|
+
log.error(`Test Failure: ${err}`);
|
|
469
|
+
done(err);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
} catch (error) {
|
|
473
|
+
log.error(`Adapter Exception: ${error}`);
|
|
474
|
+
done(error);
|
|
475
|
+
}
|
|
476
|
+
}).timeout(attemptTimeout);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
describe('#getAllProductPrices - errors', () => {
|
|
480
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
481
|
+
try {
|
|
482
|
+
a.getAllProductPrices(productsAuthKey, (data, error) => {
|
|
483
|
+
try {
|
|
484
|
+
if (stub) {
|
|
485
|
+
runCommonAsserts(data, error);
|
|
486
|
+
assert.equal(true, Array.isArray(data.response.product_prices));
|
|
487
|
+
assert.equal(false, data.response.success);
|
|
488
|
+
} else {
|
|
489
|
+
runCommonAsserts(data, error);
|
|
490
|
+
}
|
|
491
|
+
saveMockData('Products', 'getAllProductPrices', 'default', data);
|
|
492
|
+
done();
|
|
493
|
+
} catch (err) {
|
|
494
|
+
log.error(`Test Failure: ${err}`);
|
|
495
|
+
done(err);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
} catch (error) {
|
|
499
|
+
log.error(`Adapter Exception: ${error}`);
|
|
500
|
+
done(error);
|
|
501
|
+
}
|
|
502
|
+
}).timeout(attemptTimeout);
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
const productsProductId = 'fakedata';
|
|
506
|
+
describe('#getProductDetails - errors', () => {
|
|
507
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
508
|
+
try {
|
|
509
|
+
a.getProductDetails(productsAuthKey, productsProductId, (data, error) => {
|
|
510
|
+
try {
|
|
511
|
+
if (stub) {
|
|
512
|
+
const displayE = 'Error 400 received on request';
|
|
513
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
514
|
+
} else {
|
|
515
|
+
runCommonAsserts(data, error);
|
|
516
|
+
}
|
|
517
|
+
saveMockData('Products', 'getProductDetails', 'default', data);
|
|
518
|
+
done();
|
|
519
|
+
} catch (err) {
|
|
520
|
+
log.error(`Test Failure: ${err}`);
|
|
521
|
+
done(err);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
} catch (error) {
|
|
525
|
+
log.error(`Adapter Exception: ${error}`);
|
|
526
|
+
done(error);
|
|
527
|
+
}
|
|
528
|
+
}).timeout(attemptTimeout);
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
describe('#getProductPrice - errors', () => {
|
|
532
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
533
|
+
try {
|
|
534
|
+
a.getProductPrice(productsAuthKey, productsProductId, (data, error) => {
|
|
535
|
+
try {
|
|
536
|
+
if (stub) {
|
|
537
|
+
runCommonAsserts(data, error);
|
|
538
|
+
assert.equal(true, Array.isArray(data.response.product_price));
|
|
539
|
+
assert.equal(true, data.response.success);
|
|
540
|
+
} else {
|
|
541
|
+
runCommonAsserts(data, error);
|
|
542
|
+
}
|
|
543
|
+
saveMockData('Products', 'getProductPrice', 'default', data);
|
|
544
|
+
done();
|
|
545
|
+
} catch (err) {
|
|
546
|
+
log.error(`Test Failure: ${err}`);
|
|
547
|
+
done(err);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
} catch (error) {
|
|
551
|
+
log.error(`Adapter Exception: ${error}`);
|
|
552
|
+
done(error);
|
|
553
|
+
}
|
|
554
|
+
}).timeout(attemptTimeout);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
describe('#getSslProducts - errors', () => {
|
|
558
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
559
|
+
try {
|
|
560
|
+
a.getSslProducts(productsAuthKey, (data, error) => {
|
|
561
|
+
try {
|
|
562
|
+
if (stub) {
|
|
563
|
+
runCommonAsserts(data, error);
|
|
564
|
+
assert.equal(true, Array.isArray(data.response.products));
|
|
565
|
+
assert.equal(true, data.response.success);
|
|
566
|
+
} else {
|
|
567
|
+
runCommonAsserts(data, error);
|
|
568
|
+
}
|
|
569
|
+
saveMockData('Products', 'getSslProducts', '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
|
+
describe('#getSslProduct - errors', () => {
|
|
584
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
585
|
+
try {
|
|
586
|
+
a.getSslProduct(productsAuthKey, productsProductId, (data, error) => {
|
|
587
|
+
try {
|
|
588
|
+
if (stub) {
|
|
589
|
+
runCommonAsserts(data, error);
|
|
590
|
+
assert.equal('object', typeof data.response.product);
|
|
591
|
+
assert.equal(true, data.response.success);
|
|
592
|
+
} else {
|
|
593
|
+
runCommonAsserts(data, error);
|
|
594
|
+
}
|
|
595
|
+
saveMockData('Products', 'getSslProduct', 'default', data);
|
|
596
|
+
done();
|
|
597
|
+
} catch (err) {
|
|
598
|
+
log.error(`Test Failure: ${err}`);
|
|
599
|
+
done(err);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
} catch (error) {
|
|
603
|
+
log.error(`Adapter Exception: ${error}`);
|
|
604
|
+
done(error);
|
|
605
|
+
}
|
|
606
|
+
}).timeout(attemptTimeout);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
const cSRCsr = 'fakedata';
|
|
610
|
+
describe('#decodeCSR - errors', () => {
|
|
611
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
612
|
+
try {
|
|
613
|
+
a.decodeCSR(cSRCsr, (data, error) => {
|
|
614
|
+
try {
|
|
615
|
+
if (stub) {
|
|
616
|
+
runCommonAsserts(data, error);
|
|
617
|
+
assert.equal('object', typeof data.response.csrResult);
|
|
618
|
+
assert.equal(false, data.response.success);
|
|
619
|
+
} else {
|
|
620
|
+
runCommonAsserts(data, error);
|
|
621
|
+
}
|
|
622
|
+
saveMockData('CSR', 'decodeCSR', 'default', data);
|
|
623
|
+
done();
|
|
624
|
+
} catch (err) {
|
|
625
|
+
log.error(`Test Failure: ${err}`);
|
|
626
|
+
done(err);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
} catch (error) {
|
|
630
|
+
log.error(`Adapter Exception: ${error}`);
|
|
631
|
+
done(error);
|
|
632
|
+
}
|
|
633
|
+
}).timeout(attemptTimeout);
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
const cSRCsrCommonname = 'fakedata';
|
|
637
|
+
const cSRCsrOrganization = 'fakedata';
|
|
638
|
+
const cSRCsrDepartment = 'fakedata';
|
|
639
|
+
const cSRCsrCity = 'fakedata';
|
|
640
|
+
const cSRCsrState = 'fakedata';
|
|
641
|
+
const cSRCsrCountry = 'fakedata';
|
|
642
|
+
const cSRCsrEmail = 'fakedata';
|
|
643
|
+
describe('#generateCSR - errors', () => {
|
|
644
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
645
|
+
try {
|
|
646
|
+
a.generateCSR(cSRCsrCommonname, cSRCsrOrganization, cSRCsrDepartment, cSRCsrCity, cSRCsrState, cSRCsrCountry, cSRCsrEmail, (data, error) => {
|
|
647
|
+
try {
|
|
648
|
+
if (stub) {
|
|
649
|
+
runCommonAsserts(data, error);
|
|
650
|
+
assert.equal('-----BEGIN CERTIFICATE REQUEST-----\nMIICyzCCAbMCAQAwgYUxCzAJBgNVBAYTAkxWMRAwDgYDVQQIDAdMYXRnYWxlMRMw\nEQYDVQQHDApEYXVnYXZwaWxzMREwDwYDVQQKDAhPT08gdGVzdDELMAkGA1UECwwC\nSVQxETAPBgNVBAMMCHRlc3QuY29tMRwwGgYJKoZIhvcNAQkBFg1pbmZvQHRlc3Qu\nY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0O5g2LTcHSTWI8Km\nqNO/4bxldmUYW+RdyqvkWNb/Dr0H5plitoTYqlIeSyJFv7LGhnM9ragr+SGh6wYC\nntxOf2VUuxcsZklmXb9iErIGr8nGfmPTNXSYDyBk+et5GeSxhEPUpWzsMviqxg/9\njAg9ncatvaJRiaq1FGv3qyypyX6YnUlamqFy1DuHVykRueTNJWLfslqGiOuvN4/K\n9xJiHMyE9l8rb8saWrw/FubYHMlJ/8XpqUaTIfezbHjkBFTNj8Ieo5OZDB+1QzkE\n9M2SwMembOW0mDBiiUC8tUwKdh9w6L8iB7adfLINpEDupiz2ExkdYA4XPrEj0hom\nI6NXWwIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAItC8n1XVxryLH0Qoh9BTGAV\nE9I2+peVDdRM/xxRyEw3ykmYQ1iYz0ezIchfjFUl03AiILrE8cJofqfxBxgYU2E5\nH9TyKIxSeo+9LWviqGti/vgV7IdM4DYs03/KTYlWJGX0Sy1xWuvgJcqrLRfvviba\nHtT8g1eVs8YR9dgbjgA7po7RYrux2uf6fIUCk2vrFQZBCaDkm7cbqZtjNNnuId2c\nyiz1eqC4TM7SLkP7ap9N1Muw0+k/9Wzkd5ee+KEpfImMhNmQrpy6b0miEBWJrTyu\nXgtF9dFOSSdETwi/TwbOxLS5VFu/Bg/O7fyMoptSfAV6ud5g/gMU/eW4Lx1eFTg=\n-----END CERTIFICATE REQUEST-----', data.response.csr_code);
|
|
651
|
+
assert.equal('-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDQ7mDYtNwdJNYj\nwqao07/hvGV2ZRhb5F3Kq+RY1v8OvQfmmWK2hNiqUh5LIkW/ssaGcz2tqCv5IaHr\nBgKe3E5/ZVS7FyxmSWZdv2ISsgavycZ+Y9M1dJgPIGT563kZ5LGEQ9SlbOwy+KrG\nD/2MCD2dxq29olGJqrUUa/erLKnJfpidSVqaoXLUO4dXKRG55M0lYt+yWoaI6683\nj8r3EmIczIT2XytvyxpavD8W5tgcyUn/xempRpMh97NseOQEVM2Pwh6jk5kMH7VD\nOQT0zZLAx6Zs5bSYMGKJQLy1TAp2H3DovyIHtp18sg2kQO6mLPYTGR1gDhc+sSPS\nGiYjo1dbAgMBAAECggEBAKX11KQO9hGIYzlAs1XD7dWH6yiioTjNK9uDsv0Gus+g\nRBhemtTUra6NUFbqQHFHtv6xp7q7rUJV/uJLgeVipk/309hRTglqIJAzJ9ol473b\nD3ryHKGHngnV95+19holWQTxRIarAOx0LmLp7MNBAIDFgtjxiMdL/E7efHtSHQRZ\nxZf+E+Gds4MZcJdM6TnxGfarWHXuw5tEWSaIZtWBIvYK5JAhLBY3x9tNPd+IEvgU\nb2apYxtnfe1FCARD2rs0sxSWGV9yGUUnXXtGHO3Z8YPekxTw7P/6Yq7cz9cyeFpL\nb1KVN7SNikJO8DngqaKkoCN0i2frK25CnnNI1R0rreECgYEA7kbXL5gYqITp1tyz\nyKG80E7WZ+KvPOyJnT8cpUaAM+7GDFe3hsFKsVBng2TEvkhjfUaIamGWErhuDx4C\naMoX8ic0G8ZTB5jaFB8bGHPqx9+qI1vVHWcgvhjT8Aw+P2E49EQI+EaGYpkbzLB9\nemoDiM+qUdM8Q0G+DPCzJs8KfxMCgYEA4HjAsVcg+W+khdbVKAOyiU4oY7OpjIoF\nYaGT69HplVhWQtN7Hkv0JoAA6XcIqiaBM/zVZJVdY0RRDb49hVo+hI6zGZDsiGfU\nnrz3rH8K3TkPoT5OflfxTrCcpOgQ/e+EkdaQPz7iwRnF3Pu+y2hcH5MsUJul9N6y\nQJoPulOop5kCgYEA7J9Y7qDCTAfCGGeP+jvzv4GrFftdPsk/V/LmxZKfmfMSpgst\n7BpjzHYmdatKXhSRCEVVDx/d4rVYRpbsmZen9AfOjY6DwdWfK8BALiZfDyIkWXzG\nxK43K9CIF6hw4Ivx/VDa/4M5zQxzOPBDi59f5ysi3qNBAyF0VHFr16xfphUCgYAv\nwMCNeZGkPuHrLxbNmmvC1gO1oiTxpvMaH/uN8WwVv2MqeD765QGdpyGKiS4otGRM\nIP9slHH3ijMMD2qbEeW24Xysda48HoqW8nBmG+i9w0PV86FTM3Y8XUoVsuDahLfZ\nJqItMj2fAtKa/ltKfnsKpI6K33Hgs/eL0rqB0wZQEQKBgEOLZJSkOIFFGqaxvAAZ\naR5mnCYO/CGzupH42KNgyYNinvGV5l16QaaCpNIZcxV3x/HBmcx2Gr+4SIpr4N9j\nJ/oC4WwOoV0nLCYd7ZnznhDBdYvh60oeni7SGhVVgHyUN8+rn1/QxidCHHuZ3nyu\nMqEVYn1vanD47bJoe8pbgj2L\n-----END PRIVATE KEY-----', data.response.csr_key);
|
|
652
|
+
assert.equal(true, data.response.success);
|
|
653
|
+
} else {
|
|
654
|
+
runCommonAsserts(data, error);
|
|
655
|
+
}
|
|
656
|
+
saveMockData('CSR', 'generateCSR', 'default', data);
|
|
657
|
+
done();
|
|
658
|
+
} catch (err) {
|
|
659
|
+
log.error(`Test Failure: ${err}`);
|
|
660
|
+
done(err);
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
} catch (error) {
|
|
664
|
+
log.error(`Adapter Exception: ${error}`);
|
|
665
|
+
done(error);
|
|
666
|
+
}
|
|
667
|
+
}).timeout(attemptTimeout);
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
describe('#validateCSR - errors', () => {
|
|
671
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
672
|
+
try {
|
|
673
|
+
a.validateCSR(cSRCsr, (data, error) => {
|
|
674
|
+
try {
|
|
675
|
+
if (stub) {
|
|
676
|
+
const displayE = 'Error 400 received on request';
|
|
677
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
678
|
+
} else {
|
|
679
|
+
runCommonAsserts(data, error);
|
|
680
|
+
}
|
|
681
|
+
saveMockData('CSR', 'validateCSR', 'default', data);
|
|
682
|
+
done();
|
|
683
|
+
} catch (err) {
|
|
684
|
+
log.error(`Test Failure: ${err}`);
|
|
685
|
+
done(err);
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
} catch (error) {
|
|
689
|
+
log.error(`Adapter Exception: ${error}`);
|
|
690
|
+
done(error);
|
|
691
|
+
}
|
|
692
|
+
}).timeout(attemptTimeout);
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
const dCVAuthKey = 'fakedata';
|
|
696
|
+
const dCVCsr = 'fakedata';
|
|
697
|
+
describe('#getDomainAlternative - errors', () => {
|
|
698
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
699
|
+
try {
|
|
700
|
+
a.getDomainAlternative(dCVAuthKey, dCVCsr, (data, error) => {
|
|
701
|
+
try {
|
|
702
|
+
if (stub) {
|
|
703
|
+
runCommonAsserts(data, error);
|
|
704
|
+
assert.equal('object', typeof data.response.validation);
|
|
705
|
+
assert.equal(true, data.response.success);
|
|
706
|
+
} else {
|
|
707
|
+
runCommonAsserts(data, error);
|
|
708
|
+
}
|
|
709
|
+
saveMockData('DCV', 'getDomainAlternative', 'default', data);
|
|
710
|
+
done();
|
|
711
|
+
} catch (err) {
|
|
712
|
+
log.error(`Test Failure: ${err}`);
|
|
713
|
+
done(err);
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
} catch (error) {
|
|
717
|
+
log.error(`Adapter Exception: ${error}`);
|
|
718
|
+
done(error);
|
|
719
|
+
}
|
|
720
|
+
}).timeout(attemptTimeout);
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
const dCVDomain = 'fakedata';
|
|
724
|
+
describe('#getDomainEmails - errors', () => {
|
|
725
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
726
|
+
try {
|
|
727
|
+
a.getDomainEmails(dCVAuthKey, dCVDomain, (data, error) => {
|
|
728
|
+
try {
|
|
729
|
+
if (stub) {
|
|
730
|
+
runCommonAsserts(data, error);
|
|
731
|
+
assert.equal(true, data.response.error);
|
|
732
|
+
assert.equal('107', data.response.message);
|
|
733
|
+
assert.equal('Error fetching email list. Not possible to fetch approval emails for domain `example`.', data.response.description);
|
|
734
|
+
} else {
|
|
735
|
+
runCommonAsserts(data, error);
|
|
736
|
+
}
|
|
737
|
+
saveMockData('DCV', 'getDomainEmails', 'default', data);
|
|
738
|
+
done();
|
|
739
|
+
} catch (err) {
|
|
740
|
+
log.error(`Test Failure: ${err}`);
|
|
741
|
+
done(err);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
} catch (error) {
|
|
745
|
+
log.error(`Adapter Exception: ${error}`);
|
|
746
|
+
done(error);
|
|
747
|
+
}
|
|
748
|
+
}).timeout(attemptTimeout);
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
describe('#getDomainEmailsForGeotrust - errors', () => {
|
|
752
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
753
|
+
try {
|
|
754
|
+
a.getDomainEmailsForGeotrust(dCVAuthKey, dCVDomain, (data, error) => {
|
|
755
|
+
try {
|
|
756
|
+
if (stub) {
|
|
757
|
+
runCommonAsserts(data, error);
|
|
758
|
+
assert.equal(true, Array.isArray(data.response.GeotrustApprovalEmails));
|
|
759
|
+
assert.equal(true, data.response.success);
|
|
760
|
+
} else {
|
|
761
|
+
runCommonAsserts(data, error);
|
|
762
|
+
}
|
|
763
|
+
saveMockData('DCV', 'getDomainEmailsForGeotrust', 'default', data);
|
|
764
|
+
done();
|
|
765
|
+
} catch (err) {
|
|
766
|
+
log.error(`Test Failure: ${err}`);
|
|
767
|
+
done(err);
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
} catch (error) {
|
|
771
|
+
log.error(`Adapter Exception: ${error}`);
|
|
772
|
+
done(error);
|
|
773
|
+
}
|
|
774
|
+
}).timeout(attemptTimeout);
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
describe('#domainGetFromWhois - errors', () => {
|
|
778
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
779
|
+
try {
|
|
780
|
+
a.domainGetFromWhois(dCVAuthKey, dCVDomain, (data, error) => {
|
|
781
|
+
try {
|
|
782
|
+
if (stub) {
|
|
783
|
+
runCommonAsserts(data, error);
|
|
784
|
+
assert.equal(true, data.response.error);
|
|
785
|
+
assert.equal('string', data.response.message);
|
|
786
|
+
assert.equal('string', data.response.description);
|
|
787
|
+
} else {
|
|
788
|
+
runCommonAsserts(data, error);
|
|
789
|
+
}
|
|
790
|
+
saveMockData('DCV', 'domainGetFromWhois', 'default', data);
|
|
791
|
+
done();
|
|
792
|
+
} catch (err) {
|
|
793
|
+
log.error(`Test Failure: ${err}`);
|
|
794
|
+
done(err);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
} catch (error) {
|
|
798
|
+
log.error(`Adapter Exception: ${error}`);
|
|
799
|
+
done(error);
|
|
800
|
+
}
|
|
801
|
+
}).timeout(attemptTimeout);
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
const webserversAuthKey = 'fakedata';
|
|
805
|
+
const webserversSupplierId = 'fakedata';
|
|
806
|
+
describe('#getWebServers - errors', () => {
|
|
807
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
808
|
+
try {
|
|
809
|
+
a.getWebServers(webserversAuthKey, webserversSupplierId, (data, error) => {
|
|
810
|
+
try {
|
|
811
|
+
if (stub) {
|
|
812
|
+
runCommonAsserts(data, error);
|
|
813
|
+
assert.equal(true, Array.isArray(data.response.webservers));
|
|
814
|
+
assert.equal(true, data.response.success);
|
|
815
|
+
} else {
|
|
816
|
+
runCommonAsserts(data, error);
|
|
817
|
+
}
|
|
818
|
+
saveMockData('Webservers', 'getWebServers', 'default', data);
|
|
819
|
+
done();
|
|
820
|
+
} catch (err) {
|
|
821
|
+
log.error(`Test Failure: ${err}`);
|
|
822
|
+
done(err);
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
} catch (error) {
|
|
826
|
+
log.error(`Adapter Exception: ${error}`);
|
|
827
|
+
done(error);
|
|
828
|
+
}
|
|
829
|
+
}).timeout(attemptTimeout);
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
const accountAuthKey = 'fakedata';
|
|
833
|
+
describe('#getAccountDetails - errors', () => {
|
|
834
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
835
|
+
try {
|
|
836
|
+
a.getAccountDetails(accountAuthKey, (data, error) => {
|
|
837
|
+
try {
|
|
838
|
+
if (stub) {
|
|
839
|
+
runCommonAsserts(data, error);
|
|
840
|
+
assert.equal('string', data.response.first_name);
|
|
841
|
+
assert.equal('string', data.response.last_name);
|
|
842
|
+
assert.equal('string', data.response.company_name);
|
|
843
|
+
assert.equal('string', data.response.company_vat);
|
|
844
|
+
assert.equal('string', data.response.company_phone);
|
|
845
|
+
assert.equal('string', data.response.phone);
|
|
846
|
+
assert.equal('string', data.response.fax);
|
|
847
|
+
assert.equal('string', data.response.address);
|
|
848
|
+
assert.equal('string', data.response.city);
|
|
849
|
+
assert.equal('string', data.response.state);
|
|
850
|
+
assert.equal('string', data.response.postal_code);
|
|
851
|
+
assert.equal('string', data.response.country);
|
|
852
|
+
assert.equal('string', data.response.email);
|
|
853
|
+
assert.equal('string', data.response.reseller_plan);
|
|
854
|
+
assert.equal('string', data.response.currency);
|
|
855
|
+
assert.equal(true, data.response.success);
|
|
856
|
+
} else {
|
|
857
|
+
runCommonAsserts(data, error);
|
|
858
|
+
}
|
|
859
|
+
saveMockData('Account', 'getAccountDetails', 'default', data);
|
|
860
|
+
done();
|
|
861
|
+
} catch (err) {
|
|
862
|
+
log.error(`Test Failure: ${err}`);
|
|
863
|
+
done(err);
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
} catch (error) {
|
|
867
|
+
log.error(`Adapter Exception: ${error}`);
|
|
868
|
+
done(error);
|
|
869
|
+
}
|
|
870
|
+
}).timeout(attemptTimeout);
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
describe('#getAccountBalance - errors', () => {
|
|
874
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
875
|
+
try {
|
|
876
|
+
a.getAccountBalance(accountAuthKey, (data, error) => {
|
|
877
|
+
try {
|
|
878
|
+
if (stub) {
|
|
879
|
+
runCommonAsserts(data, error);
|
|
880
|
+
assert.equal('string', data.response.balance);
|
|
881
|
+
assert.equal('string', data.response.currency);
|
|
882
|
+
assert.equal(false, data.response.success);
|
|
883
|
+
} else {
|
|
884
|
+
runCommonAsserts(data, error);
|
|
885
|
+
}
|
|
886
|
+
saveMockData('Account', 'getAccountBalance', 'default', data);
|
|
887
|
+
done();
|
|
888
|
+
} catch (err) {
|
|
889
|
+
log.error(`Test Failure: ${err}`);
|
|
890
|
+
done(err);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
} catch (error) {
|
|
894
|
+
log.error(`Adapter Exception: ${error}`);
|
|
895
|
+
done(error);
|
|
896
|
+
}
|
|
897
|
+
}).timeout(attemptTimeout);
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
const lEIAuthKey = 'fakedata';
|
|
901
|
+
const lEIOrderId = 'fakedata';
|
|
902
|
+
const lEIConfirm = 555;
|
|
903
|
+
describe('#confirmLEIDataQuality - errors', () => {
|
|
904
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
905
|
+
try {
|
|
906
|
+
a.confirmLEIDataQuality(lEIAuthKey, lEIOrderId, lEIConfirm, (data, error) => {
|
|
907
|
+
try {
|
|
908
|
+
if (stub) {
|
|
909
|
+
const displayE = 'Error 400 received on request';
|
|
910
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
911
|
+
} else {
|
|
912
|
+
runCommonAsserts(data, error);
|
|
913
|
+
}
|
|
914
|
+
saveMockData('LEI', 'confirmLEIDataQuality', 'default', data);
|
|
915
|
+
done();
|
|
916
|
+
} catch (err) {
|
|
917
|
+
log.error(`Test Failure: ${err}`);
|
|
918
|
+
done(err);
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
} catch (error) {
|
|
922
|
+
log.error(`Adapter Exception: ${error}`);
|
|
923
|
+
done(error);
|
|
924
|
+
}
|
|
925
|
+
}).timeout(attemptTimeout);
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
const lEITest = 555;
|
|
929
|
+
const lEIProductId = 555;
|
|
930
|
+
const lEILegalName = 'fakedata';
|
|
931
|
+
const lEILastName = 'fakedata';
|
|
932
|
+
const lEIIsLevel2DataAvailable = 555;
|
|
933
|
+
const lEIIncorporationDate = 'fakedata';
|
|
934
|
+
const lEILegalState = 'fakedata';
|
|
935
|
+
const lEILegalPostal = 'fakedata';
|
|
936
|
+
const lEILegalfirstAddressLine = 'fakedata';
|
|
937
|
+
const lEILegalCountry = 'fakedata';
|
|
938
|
+
const lEILegalCity = 'fakedata';
|
|
939
|
+
const lEIMultiYearSupport = 555;
|
|
940
|
+
describe('#createNewLEI - errors', () => {
|
|
941
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
942
|
+
try {
|
|
943
|
+
a.createNewLEI(lEIAuthKey, lEITest, lEIProductId, lEILegalName, lEILastName, lEIIsLevel2DataAvailable, lEIIncorporationDate, lEILegalState, lEILegalPostal, lEILegalfirstAddressLine, lEILegalCountry, lEILegalCity, lEIMultiYearSupport, (data, error) => {
|
|
944
|
+
try {
|
|
945
|
+
if (stub) {
|
|
946
|
+
runCommonAsserts(data, error);
|
|
947
|
+
assert.equal('string', data.response.product_id);
|
|
948
|
+
assert.equal('string', data.response.order_number);
|
|
949
|
+
assert.equal('string', data.response.orderId);
|
|
950
|
+
assert.equal('string', data.response.invoice_num);
|
|
951
|
+
assert.equal('string', data.response.invoice_id);
|
|
952
|
+
assert.equal('string', data.response.lei_id);
|
|
953
|
+
assert.equal(7, data.response.order_amount);
|
|
954
|
+
assert.equal('string', data.response.currency);
|
|
955
|
+
assert.equal('string', data.response.tax);
|
|
956
|
+
assert.equal('string', data.response.tax_rate);
|
|
957
|
+
assert.equal(true, data.response.success);
|
|
958
|
+
} else {
|
|
959
|
+
runCommonAsserts(data, error);
|
|
960
|
+
}
|
|
961
|
+
saveMockData('LEI', 'createNewLEI', 'default', data);
|
|
962
|
+
done();
|
|
963
|
+
} catch (err) {
|
|
964
|
+
log.error(`Test Failure: ${err}`);
|
|
965
|
+
done(err);
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
} catch (error) {
|
|
969
|
+
log.error(`Adapter Exception: ${error}`);
|
|
970
|
+
done(error);
|
|
971
|
+
}
|
|
972
|
+
}).timeout(attemptTimeout);
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
const lEIIsLevel1DataSame = 555;
|
|
976
|
+
const lEIFirstName = 'fakedata';
|
|
977
|
+
describe('#renewLEI - errors', () => {
|
|
978
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
979
|
+
try {
|
|
980
|
+
a.renewLEI(lEIAuthKey, lEIOrderId, lEIIsLevel1DataSame, lEIFirstName, lEILastName, (data, error) => {
|
|
981
|
+
try {
|
|
982
|
+
if (stub) {
|
|
983
|
+
const displayE = 'Error 400 received on request';
|
|
984
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
985
|
+
} else {
|
|
986
|
+
runCommonAsserts(data, error);
|
|
987
|
+
}
|
|
988
|
+
saveMockData('LEI', 'renewLEI', 'default', data);
|
|
989
|
+
done();
|
|
990
|
+
} catch (err) {
|
|
991
|
+
log.error(`Test Failure: ${err}`);
|
|
992
|
+
done(err);
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
} catch (error) {
|
|
996
|
+
log.error(`Adapter Exception: ${error}`);
|
|
997
|
+
done(error);
|
|
998
|
+
}
|
|
999
|
+
}).timeout(attemptTimeout);
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
describe('#getLEIJurisdictions - errors', () => {
|
|
1003
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1004
|
+
try {
|
|
1005
|
+
a.getLEIJurisdictions(lEIAuthKey, (data, error) => {
|
|
1006
|
+
try {
|
|
1007
|
+
if (stub) {
|
|
1008
|
+
const displayE = 'Error 400 received on request';
|
|
1009
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1010
|
+
} else {
|
|
1011
|
+
runCommonAsserts(data, error);
|
|
1012
|
+
}
|
|
1013
|
+
saveMockData('LEI', 'getLEIJurisdictions', 'default', data);
|
|
1014
|
+
done();
|
|
1015
|
+
} catch (err) {
|
|
1016
|
+
log.error(`Test Failure: ${err}`);
|
|
1017
|
+
done(err);
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
} catch (error) {
|
|
1021
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1022
|
+
done(error);
|
|
1023
|
+
}
|
|
1024
|
+
}).timeout(attemptTimeout);
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
const lEIQuery = 'fakedata';
|
|
1028
|
+
describe('#leiLoolup - errors', () => {
|
|
1029
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1030
|
+
try {
|
|
1031
|
+
a.leiLoolup(lEIAuthKey, lEIQuery, (data, error) => {
|
|
1032
|
+
try {
|
|
1033
|
+
if (stub) {
|
|
1034
|
+
const displayE = 'Error 400 received on request';
|
|
1035
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1036
|
+
} else {
|
|
1037
|
+
runCommonAsserts(data, error);
|
|
1038
|
+
}
|
|
1039
|
+
saveMockData('LEI', 'leiLoolup', 'default', data);
|
|
1040
|
+
done();
|
|
1041
|
+
} catch (err) {
|
|
1042
|
+
log.error(`Test Failure: ${err}`);
|
|
1043
|
+
done(err);
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
} catch (error) {
|
|
1047
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1048
|
+
done(error);
|
|
1049
|
+
}
|
|
1050
|
+
}).timeout(attemptTimeout);
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
describe('#getLeiStatus - errors', () => {
|
|
1054
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1055
|
+
try {
|
|
1056
|
+
a.getLeiStatus(lEIAuthKey, lEIOrderId, (data, error) => {
|
|
1057
|
+
try {
|
|
1058
|
+
if (stub) {
|
|
1059
|
+
runCommonAsserts(data, error);
|
|
1060
|
+
assert.equal(false, data.response.error);
|
|
1061
|
+
assert.equal('string', data.response.message);
|
|
1062
|
+
assert.equal('string', data.response.description);
|
|
1063
|
+
} else {
|
|
1064
|
+
runCommonAsserts(data, error);
|
|
1065
|
+
}
|
|
1066
|
+
saveMockData('LEI', 'getLeiStatus', 'default', data);
|
|
1067
|
+
done();
|
|
1068
|
+
} catch (err) {
|
|
1069
|
+
log.error(`Test Failure: ${err}`);
|
|
1070
|
+
done(err);
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
} catch (error) {
|
|
1074
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1075
|
+
done(error);
|
|
1076
|
+
}
|
|
1077
|
+
}).timeout(attemptTimeout);
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
const ordersAuthKey = 'fakedata';
|
|
1081
|
+
const ordersCsr = 'fakedata';
|
|
1082
|
+
const ordersServerCount = 555;
|
|
1083
|
+
const ordersPeriod = 555;
|
|
1084
|
+
const ordersWebserverType = 555;
|
|
1085
|
+
const ordersAdminFirstname = 'fakedata';
|
|
1086
|
+
const ordersAdminLastname = 'fakedata';
|
|
1087
|
+
const ordersAdminPhone = 555;
|
|
1088
|
+
const ordersAdminTitle = 'fakedata';
|
|
1089
|
+
const ordersAdminEmail = 'fakedata';
|
|
1090
|
+
const ordersAdminCity = 'fakedata';
|
|
1091
|
+
const ordersAdminCountry = 'fakedata';
|
|
1092
|
+
const ordersAdminPostalcode = 'fakedata';
|
|
1093
|
+
const ordersDcvMethod = 'fakedata';
|
|
1094
|
+
const ordersTechFirstname = 'fakedata';
|
|
1095
|
+
const ordersTechLastname = 'fakedata';
|
|
1096
|
+
const ordersTechPhone = 555;
|
|
1097
|
+
const ordersTechTitle = 'fakedata';
|
|
1098
|
+
const ordersTechEmail = 'fakedata';
|
|
1099
|
+
const ordersTechAddressline1 = 'fakedata';
|
|
1100
|
+
const ordersAdminAddressline1 = 'fakedata';
|
|
1101
|
+
let ordersOrderId = 'fakedata';
|
|
1102
|
+
describe('#addSSLOrder - errors', () => {
|
|
1103
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1104
|
+
try {
|
|
1105
|
+
a.addSSLOrder(ordersAuthKey, 555, ordersCsr, ordersServerCount, ordersPeriod, ordersWebserverType, ordersAdminFirstname, ordersAdminLastname, ordersAdminPhone, ordersAdminTitle, ordersAdminEmail, ordersAdminCity, ordersAdminCountry, ordersAdminPostalcode, ordersDcvMethod, ordersTechFirstname, ordersTechLastname, ordersTechPhone, ordersTechTitle, ordersTechEmail, ordersTechAddressline1, ordersAdminAddressline1, (data, error) => {
|
|
1106
|
+
try {
|
|
1107
|
+
if (stub) {
|
|
1108
|
+
runCommonAsserts(data, error);
|
|
1109
|
+
assert.equal('77', data.response.productId);
|
|
1110
|
+
assert.equal('object', typeof data.response.approver_method);
|
|
1111
|
+
assert.equal(1332864, data.response.orderId);
|
|
1112
|
+
assert.equal(908032, data.response.invoice_id);
|
|
1113
|
+
assert.equal('active', data.response.order_status);
|
|
1114
|
+
assert.equal(true, data.response.success);
|
|
1115
|
+
assert.equal(true, Array.isArray(data.response.san));
|
|
1116
|
+
assert.equal(67.61, data.response.order_amount);
|
|
1117
|
+
assert.equal('EUR', data.response.currency);
|
|
1118
|
+
assert.equal('12.64', data.response.tax);
|
|
1119
|
+
assert.equal('23%', data.response.tax_rate);
|
|
1120
|
+
} else {
|
|
1121
|
+
runCommonAsserts(data, error);
|
|
1122
|
+
}
|
|
1123
|
+
ordersOrderId = data.response.orderId;
|
|
1124
|
+
saveMockData('Orders', 'addSSLOrder', 'default', data);
|
|
1125
|
+
done();
|
|
1126
|
+
} catch (err) {
|
|
1127
|
+
log.error(`Test Failure: ${err}`);
|
|
1128
|
+
done(err);
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
} catch (error) {
|
|
1132
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1133
|
+
done(error);
|
|
1134
|
+
}
|
|
1135
|
+
}).timeout(attemptTimeout);
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
const ordersProductId = 555;
|
|
1139
|
+
const ordersApproverEmail = 'fakedata';
|
|
1140
|
+
const ordersAdminOrganization = 'fakedata';
|
|
1141
|
+
const ordersTechOrganization = 'fakedata';
|
|
1142
|
+
const ordersTechCity = 'fakedata';
|
|
1143
|
+
const ordersTechCountry = 'fakedata';
|
|
1144
|
+
const ordersOrgDivision = 'fakedata';
|
|
1145
|
+
const ordersOrgAddressline1 = 'fakedata';
|
|
1146
|
+
const ordersOrgCity = 'fakedata';
|
|
1147
|
+
const ordersOrgCountry = 'fakedata';
|
|
1148
|
+
const ordersOrgPhone = 555;
|
|
1149
|
+
const ordersOrgPostalcode = 555;
|
|
1150
|
+
const ordersOrgRegion = 'fakedata';
|
|
1151
|
+
const ordersApproverEmails = 'fakedata';
|
|
1152
|
+
const ordersDnsNames = 'fakedata';
|
|
1153
|
+
const ordersSignatureHash = 'fakedata';
|
|
1154
|
+
const ordersTest = 'fakedata';
|
|
1155
|
+
describe('#addSSLRenewOrder - errors', () => {
|
|
1156
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1157
|
+
try {
|
|
1158
|
+
a.addSSLRenewOrder(ordersAuthKey, ordersProductId, ordersCsr, ordersServerCount, ordersPeriod, ordersApproverEmail, ordersWebserverType, ordersAdminFirstname, ordersAdminLastname, ordersAdminPhone, ordersAdminTitle, ordersAdminEmail, ordersAdminCity, ordersAdminCountry, ordersAdminOrganization, ordersDcvMethod, ordersTechFirstname, ordersTechLastname, ordersTechPhone, ordersTechTitle, ordersTechEmail, ordersTechAddressline1, ordersAdminAddressline1, ordersTechOrganization, ordersTechCity, ordersTechCountry, ordersOrgDivision, ordersOrgAddressline1, ordersOrgCity, ordersOrgCountry, ordersOrgPhone, ordersOrgPostalcode, ordersOrgRegion, ordersApproverEmails, ordersDnsNames, ordersSignatureHash, ordersTest, (data, error) => {
|
|
1159
|
+
try {
|
|
1160
|
+
if (stub) {
|
|
1161
|
+
const displayE = 'Error 400 received on request';
|
|
1162
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1163
|
+
} else {
|
|
1164
|
+
runCommonAsserts(data, error);
|
|
1165
|
+
}
|
|
1166
|
+
saveMockData('Orders', 'addSSLRenewOrder', 'default', data);
|
|
1167
|
+
done();
|
|
1168
|
+
} catch (err) {
|
|
1169
|
+
log.error(`Test Failure: ${err}`);
|
|
1170
|
+
done(err);
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
} catch (error) {
|
|
1174
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1175
|
+
done(error);
|
|
1176
|
+
}
|
|
1177
|
+
}).timeout(attemptTimeout);
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
const ordersCount = 555;
|
|
1181
|
+
const ordersWildcardSanCount = 555;
|
|
1182
|
+
const ordersSingleSanCount = 555;
|
|
1183
|
+
describe('#addSSLSANOrder - errors', () => {
|
|
1184
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1185
|
+
try {
|
|
1186
|
+
a.addSSLSANOrder(ordersAuthKey, ordersOrderId, ordersCount, ordersWildcardSanCount, ordersSingleSanCount, (data, error) => {
|
|
1187
|
+
try {
|
|
1188
|
+
if (stub) {
|
|
1189
|
+
runCommonAsserts(data, error);
|
|
1190
|
+
assert.equal(1146951, data.response.orderId);
|
|
1191
|
+
assert.equal(786148, data.response.invoice_id);
|
|
1192
|
+
assert.equal('active', data.response.order_status);
|
|
1193
|
+
assert.equal(true, data.response.success);
|
|
1194
|
+
assert.equal(248.73, data.response.order_amount);
|
|
1195
|
+
assert.equal('EUR', data.response.currency);
|
|
1196
|
+
assert.equal('0.00', data.response.tax);
|
|
1197
|
+
assert.equal('0%', data.response.tax_rate);
|
|
1198
|
+
} else {
|
|
1199
|
+
runCommonAsserts(data, error);
|
|
1200
|
+
}
|
|
1201
|
+
saveMockData('Orders', 'addSSLSANOrder', 'default', data);
|
|
1202
|
+
done();
|
|
1203
|
+
} catch (err) {
|
|
1204
|
+
log.error(`Test Failure: ${err}`);
|
|
1205
|
+
done(err);
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
} catch (error) {
|
|
1209
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1210
|
+
done(error);
|
|
1211
|
+
}
|
|
1212
|
+
}).timeout(attemptTimeout);
|
|
1213
|
+
});
|
|
1214
|
+
|
|
1215
|
+
const ordersReason = 'fakedata';
|
|
1216
|
+
describe('#cancelOrder - errors', () => {
|
|
1217
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1218
|
+
try {
|
|
1219
|
+
a.cancelOrder(ordersAuthKey, ordersOrderId, ordersReason, (data, error) => {
|
|
1220
|
+
try {
|
|
1221
|
+
if (stub) {
|
|
1222
|
+
runCommonAsserts(data, error);
|
|
1223
|
+
assert.equal('Cancell request submitted.', data.response.message);
|
|
1224
|
+
assert.equal(true, data.response.success);
|
|
1225
|
+
} else {
|
|
1226
|
+
runCommonAsserts(data, error);
|
|
1227
|
+
}
|
|
1228
|
+
saveMockData('Orders', 'cancelOrder', 'default', data);
|
|
1229
|
+
done();
|
|
1230
|
+
} catch (err) {
|
|
1231
|
+
log.error(`Test Failure: ${err}`);
|
|
1232
|
+
done(err);
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
} catch (error) {
|
|
1236
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1237
|
+
done(error);
|
|
1238
|
+
}
|
|
1239
|
+
}).timeout(attemptTimeout);
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
describe('#comodoClaimFreeEV - errors', () => {
|
|
1243
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1244
|
+
try {
|
|
1245
|
+
a.comodoClaimFreeEV(ordersAuthKey, ordersOrderId, (data, error) => {
|
|
1246
|
+
try {
|
|
1247
|
+
if (stub) {
|
|
1248
|
+
runCommonAsserts(data, error);
|
|
1249
|
+
assert.equal(true, data.response.error);
|
|
1250
|
+
assert.equal('124', data.response.message);
|
|
1251
|
+
assert.equal('Order can\'t be processed with Free EV upgrade, wait for order to become active!', data.response.description);
|
|
1252
|
+
} else {
|
|
1253
|
+
runCommonAsserts(data, error);
|
|
1254
|
+
}
|
|
1255
|
+
saveMockData('Orders', 'comodoClaimFreeEV', 'default', data);
|
|
1256
|
+
done();
|
|
1257
|
+
} catch (err) {
|
|
1258
|
+
log.error(`Test Failure: ${err}`);
|
|
1259
|
+
done(err);
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
} catch (error) {
|
|
1263
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1264
|
+
done(error);
|
|
1265
|
+
}
|
|
1266
|
+
}).timeout(attemptTimeout);
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
const ordersUniqueCode = 'fakedata';
|
|
1270
|
+
describe('#reissueSSLOrder - errors', () => {
|
|
1271
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1272
|
+
try {
|
|
1273
|
+
a.reissueSSLOrder(ordersAuthKey, ordersOrderId, ordersWebserverType, ordersCsr, ordersDcvMethod, ordersDnsNames, ordersApproverEmails, ordersApproverEmail, ordersSignatureHash, ordersUniqueCode, (data, error) => {
|
|
1274
|
+
try {
|
|
1275
|
+
if (stub) {
|
|
1276
|
+
const displayE = 'Error 400 received on request';
|
|
1277
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1278
|
+
} else {
|
|
1279
|
+
runCommonAsserts(data, error);
|
|
1280
|
+
}
|
|
1281
|
+
saveMockData('Orders', 'reissueSSLOrder', 'default', data);
|
|
1282
|
+
done();
|
|
1283
|
+
} catch (err) {
|
|
1284
|
+
log.error(`Test Failure: ${err}`);
|
|
1285
|
+
done(err);
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
} catch (error) {
|
|
1289
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1290
|
+
done(error);
|
|
1291
|
+
}
|
|
1292
|
+
}).timeout(attemptTimeout);
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
const ordersCids = 'fakedata';
|
|
1296
|
+
describe('#getOrdersStatuses - errors', () => {
|
|
1297
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1298
|
+
try {
|
|
1299
|
+
a.getOrdersStatuses(ordersAuthKey, ordersCids, (data, error) => {
|
|
1300
|
+
try {
|
|
1301
|
+
if (stub) {
|
|
1302
|
+
runCommonAsserts(data, error);
|
|
1303
|
+
assert.equal(true, Array.isArray(data.response.certificates));
|
|
1304
|
+
assert.equal(true, data.response.success);
|
|
1305
|
+
assert.equal(1637157818, data.response.time_stamp);
|
|
1306
|
+
} else {
|
|
1307
|
+
runCommonAsserts(data, error);
|
|
1308
|
+
}
|
|
1309
|
+
saveMockData('Orders', 'getOrdersStatuses', 'default', data);
|
|
1310
|
+
done();
|
|
1311
|
+
} catch (err) {
|
|
1312
|
+
log.error(`Test Failure: ${err}`);
|
|
1313
|
+
done(err);
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
} catch (error) {
|
|
1317
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1318
|
+
done(error);
|
|
1319
|
+
}
|
|
1320
|
+
}).timeout(attemptTimeout);
|
|
1321
|
+
});
|
|
1322
|
+
|
|
1323
|
+
describe('#getTotalOrders - errors', () => {
|
|
1324
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1325
|
+
try {
|
|
1326
|
+
a.getTotalOrders(ordersAuthKey, (data, error) => {
|
|
1327
|
+
try {
|
|
1328
|
+
if (stub) {
|
|
1329
|
+
runCommonAsserts(data, error);
|
|
1330
|
+
assert.equal(6, data.response.total_orders);
|
|
1331
|
+
assert.equal(false, data.response.success);
|
|
1332
|
+
} else {
|
|
1333
|
+
runCommonAsserts(data, error);
|
|
1334
|
+
}
|
|
1335
|
+
saveMockData('Orders', 'getTotalOrders', 'default', data);
|
|
1336
|
+
done();
|
|
1337
|
+
} catch (err) {
|
|
1338
|
+
log.error(`Test Failure: ${err}`);
|
|
1339
|
+
done(err);
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
} catch (error) {
|
|
1343
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1344
|
+
done(error);
|
|
1345
|
+
}
|
|
1346
|
+
}).timeout(attemptTimeout);
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
describe('#getUnpaidOrders - errors', () => {
|
|
1350
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1351
|
+
try {
|
|
1352
|
+
a.getUnpaidOrders(ordersAuthKey, (data, error) => {
|
|
1353
|
+
try {
|
|
1354
|
+
if (stub) {
|
|
1355
|
+
runCommonAsserts(data, error);
|
|
1356
|
+
assert.equal(true, Array.isArray(data.response.orders));
|
|
1357
|
+
assert.equal(true, data.response.success);
|
|
1358
|
+
} else {
|
|
1359
|
+
runCommonAsserts(data, error);
|
|
1360
|
+
}
|
|
1361
|
+
saveMockData('Orders', 'getUnpaidOrders', 'default', data);
|
|
1362
|
+
done();
|
|
1363
|
+
} catch (err) {
|
|
1364
|
+
log.error(`Test Failure: ${err}`);
|
|
1365
|
+
done(err);
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1370
|
+
done(error);
|
|
1371
|
+
}
|
|
1372
|
+
}).timeout(attemptTimeout);
|
|
1373
|
+
});
|
|
1374
|
+
|
|
1375
|
+
describe('#getAllSSLOrders - errors', () => {
|
|
1376
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1377
|
+
try {
|
|
1378
|
+
a.getAllSSLOrders(ordersAuthKey, 555, 555, (data, error) => {
|
|
1379
|
+
try {
|
|
1380
|
+
if (stub) {
|
|
1381
|
+
runCommonAsserts(data, error);
|
|
1382
|
+
assert.equal(true, Array.isArray(data.response.orders));
|
|
1383
|
+
assert.equal(5, data.response.limit);
|
|
1384
|
+
assert.equal(4, data.response.offset);
|
|
1385
|
+
assert.equal(2, data.response.count);
|
|
1386
|
+
assert.equal(true, data.response.success);
|
|
1387
|
+
} else {
|
|
1388
|
+
runCommonAsserts(data, error);
|
|
1389
|
+
}
|
|
1390
|
+
saveMockData('Orders', 'getAllSSLOrders', 'default', data);
|
|
1391
|
+
done();
|
|
1392
|
+
} catch (err) {
|
|
1393
|
+
log.error(`Test Failure: ${err}`);
|
|
1394
|
+
done(err);
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
} catch (error) {
|
|
1398
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1399
|
+
done(error);
|
|
1400
|
+
}
|
|
1401
|
+
}).timeout(attemptTimeout);
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
describe('#recheckCAA - errors', () => {
|
|
1405
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1406
|
+
try {
|
|
1407
|
+
a.recheckCAA(ordersAuthKey, ordersOrderId, (data, error) => {
|
|
1408
|
+
try {
|
|
1409
|
+
if (stub) {
|
|
1410
|
+
runCommonAsserts(data, error);
|
|
1411
|
+
assert.equal(false, data.response.error);
|
|
1412
|
+
assert.equal('string', data.response.message);
|
|
1413
|
+
assert.equal('string', data.response.description);
|
|
1414
|
+
} else {
|
|
1415
|
+
runCommonAsserts(data, error);
|
|
1416
|
+
}
|
|
1417
|
+
saveMockData('Orders', 'recheckCAA', 'default', data);
|
|
1418
|
+
done();
|
|
1419
|
+
} catch (err) {
|
|
1420
|
+
log.error(`Test Failure: ${err}`);
|
|
1421
|
+
done(err);
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1426
|
+
done(error);
|
|
1427
|
+
}
|
|
1428
|
+
}).timeout(attemptTimeout);
|
|
1429
|
+
});
|
|
1430
|
+
|
|
1431
|
+
describe('#getOrderStatus - errors', () => {
|
|
1432
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1433
|
+
try {
|
|
1434
|
+
a.getOrderStatus(ordersAuthKey, ordersOrderId, (data, error) => {
|
|
1435
|
+
try {
|
|
1436
|
+
if (stub) {
|
|
1437
|
+
runCommonAsserts(data, error);
|
|
1438
|
+
assert.equal(1146748, data.response.orderId);
|
|
1439
|
+
assert.equal(123456789, data.response.partner_order_id);
|
|
1440
|
+
assert.equal('S1130555', data.response.internal_id);
|
|
1441
|
+
assert.equal('processing', data.response.status);
|
|
1442
|
+
assert.equal('', data.response.status_description);
|
|
1443
|
+
assert.equal('1', data.response.dcv_status);
|
|
1444
|
+
assert.equal('77', data.response.productId);
|
|
1445
|
+
assert.equal('my-domain.tld', data.response.domain);
|
|
1446
|
+
assert.equal('object', typeof data.response.approver_method);
|
|
1447
|
+
assert.equal('my-domain.tld,www.my-domain.tld,my-domain1.tld', data.response.domains);
|
|
1448
|
+
} else {
|
|
1449
|
+
runCommonAsserts(data, error);
|
|
1450
|
+
}
|
|
1451
|
+
saveMockData('Orders', 'getOrderStatus', 'default', data);
|
|
1452
|
+
done();
|
|
1453
|
+
} catch (err) {
|
|
1454
|
+
log.error(`Test Failure: ${err}`);
|
|
1455
|
+
done(err);
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
} catch (error) {
|
|
1459
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1460
|
+
done(error);
|
|
1461
|
+
}
|
|
1462
|
+
}).timeout(attemptTimeout);
|
|
1463
|
+
});
|
|
1464
|
+
|
|
1465
|
+
const validationAuthKey = 'fakedata';
|
|
1466
|
+
const validationOrderId = 'fakedata';
|
|
1467
|
+
const validationDomainName = 'fakedata';
|
|
1468
|
+
const validationNewMethod = 'fakedata';
|
|
1469
|
+
describe('#changeDcv - errors', () => {
|
|
1470
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1471
|
+
try {
|
|
1472
|
+
a.changeDcv(validationAuthKey, validationOrderId, validationDomainName, validationNewMethod, (data, error) => {
|
|
1473
|
+
try {
|
|
1474
|
+
if (stub) {
|
|
1475
|
+
runCommonAsserts(data, error);
|
|
1476
|
+
assert.equal('63', data.response.product_id);
|
|
1477
|
+
assert.equal('object', typeof data.response.validation);
|
|
1478
|
+
assert.equal('Validation method has been successfully updated', data.response.success_message);
|
|
1479
|
+
assert.equal(true, data.response.success);
|
|
1480
|
+
} else {
|
|
1481
|
+
runCommonAsserts(data, error);
|
|
1482
|
+
}
|
|
1483
|
+
saveMockData('Validation', 'changeDcv', 'default', data);
|
|
1484
|
+
done();
|
|
1485
|
+
} catch (err) {
|
|
1486
|
+
log.error(`Test Failure: ${err}`);
|
|
1487
|
+
done(err);
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1492
|
+
done(error);
|
|
1493
|
+
}
|
|
1494
|
+
}).timeout(attemptTimeout);
|
|
1495
|
+
});
|
|
1496
|
+
|
|
1497
|
+
const validationNewMethods = 'fakedata';
|
|
1498
|
+
const validationDomains = 'fakedata';
|
|
1499
|
+
describe('#changeDomainsValidationMethod - errors', () => {
|
|
1500
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1501
|
+
try {
|
|
1502
|
+
a.changeDomainsValidationMethod(validationAuthKey, validationOrderId, validationNewMethods, validationDomains, (data, error) => {
|
|
1503
|
+
try {
|
|
1504
|
+
if (stub) {
|
|
1505
|
+
runCommonAsserts(data, error);
|
|
1506
|
+
assert.equal('Change Validation request submitted.', data.response.message);
|
|
1507
|
+
assert.equal(true, data.response.success);
|
|
1508
|
+
} else {
|
|
1509
|
+
runCommonAsserts(data, error);
|
|
1510
|
+
}
|
|
1511
|
+
saveMockData('Validation', 'changeDomainsValidationMethod', 'default', data);
|
|
1512
|
+
done();
|
|
1513
|
+
} catch (err) {
|
|
1514
|
+
log.error(`Test Failure: ${err}`);
|
|
1515
|
+
done(err);
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
} catch (error) {
|
|
1519
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1520
|
+
done(error);
|
|
1521
|
+
}
|
|
1522
|
+
}).timeout(attemptTimeout);
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
const validationApproverEmail = 'fakedata';
|
|
1526
|
+
describe('#changeValidationEmail - errors', () => {
|
|
1527
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1528
|
+
try {
|
|
1529
|
+
a.changeValidationEmail(validationAuthKey, validationOrderId, validationApproverEmail, (data, error) => {
|
|
1530
|
+
try {
|
|
1531
|
+
if (stub) {
|
|
1532
|
+
const displayE = 'Error 400 received on request';
|
|
1533
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1534
|
+
} else {
|
|
1535
|
+
runCommonAsserts(data, error);
|
|
1536
|
+
}
|
|
1537
|
+
saveMockData('Validation', 'changeValidationEmail', 'default', data);
|
|
1538
|
+
done();
|
|
1539
|
+
} catch (err) {
|
|
1540
|
+
log.error(`Test Failure: ${err}`);
|
|
1541
|
+
done(err);
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
} catch (error) {
|
|
1545
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1546
|
+
done(error);
|
|
1547
|
+
}
|
|
1548
|
+
}).timeout(attemptTimeout);
|
|
1549
|
+
});
|
|
1550
|
+
|
|
1551
|
+
const validationDomain = 'fakedata';
|
|
1552
|
+
describe('#changeValidationMethod - errors', () => {
|
|
1553
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1554
|
+
try {
|
|
1555
|
+
a.changeValidationMethod(validationAuthKey, validationOrderId, validationDomain, validationNewMethod, (data, error) => {
|
|
1556
|
+
try {
|
|
1557
|
+
if (stub) {
|
|
1558
|
+
const displayE = 'Error 400 received on request';
|
|
1559
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-GoGetSSL-connectorRest-handleEndResponse', displayE);
|
|
1560
|
+
} else {
|
|
1561
|
+
runCommonAsserts(data, error);
|
|
1562
|
+
}
|
|
1563
|
+
saveMockData('Validation', 'changeValidationMethod', 'default', data);
|
|
1564
|
+
done();
|
|
1565
|
+
} catch (err) {
|
|
1566
|
+
log.error(`Test Failure: ${err}`);
|
|
1567
|
+
done(err);
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
} catch (error) {
|
|
1571
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1572
|
+
done(error);
|
|
1573
|
+
}
|
|
1574
|
+
}).timeout(attemptTimeout);
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
describe('#resend - errors', () => {
|
|
1578
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1579
|
+
try {
|
|
1580
|
+
a.resend(validationAuthKey, validationOrderId, validationDomain, (data, error) => {
|
|
1581
|
+
try {
|
|
1582
|
+
if (stub) {
|
|
1583
|
+
runCommonAsserts(data, error);
|
|
1584
|
+
assert.equal(true, data.response.error);
|
|
1585
|
+
assert.equal('Resend error', data.response.message);
|
|
1586
|
+
assert.equal('Resend can be call only for Email validation type.', data.response.description);
|
|
1587
|
+
} else {
|
|
1588
|
+
runCommonAsserts(data, error);
|
|
1589
|
+
}
|
|
1590
|
+
saveMockData('Validation', 'resend', 'default', data);
|
|
1591
|
+
done();
|
|
1592
|
+
} catch (err) {
|
|
1593
|
+
log.error(`Test Failure: ${err}`);
|
|
1594
|
+
done(err);
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
} catch (error) {
|
|
1598
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1599
|
+
done(error);
|
|
1600
|
+
}
|
|
1601
|
+
}).timeout(attemptTimeout);
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
describe('#revalidate - errors', () => {
|
|
1605
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1606
|
+
try {
|
|
1607
|
+
a.revalidate(validationAuthKey, validationOrderId, (data, error) => {
|
|
1608
|
+
try {
|
|
1609
|
+
if (stub) {
|
|
1610
|
+
runCommonAsserts(data, error);
|
|
1611
|
+
assert.equal(true, data.response.error);
|
|
1612
|
+
assert.equal('Domain error', data.response.message);
|
|
1613
|
+
assert.equal('This domain name not found in this certificate.', data.response.description);
|
|
1614
|
+
} else {
|
|
1615
|
+
runCommonAsserts(data, error);
|
|
1616
|
+
}
|
|
1617
|
+
saveMockData('Validation', 'revalidate', 'default', data);
|
|
1618
|
+
done();
|
|
1619
|
+
} catch (err) {
|
|
1620
|
+
log.error(`Test Failure: ${err}`);
|
|
1621
|
+
done(err);
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
} catch (error) {
|
|
1625
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1626
|
+
done(error);
|
|
1627
|
+
}
|
|
1628
|
+
}).timeout(attemptTimeout);
|
|
1629
|
+
});
|
|
1630
|
+
|
|
1631
|
+
describe('#resendValidationEmail - errors', () => {
|
|
1632
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1633
|
+
try {
|
|
1634
|
+
a.resendValidationEmail(validationAuthKey, validationOrderId, (data, error) => {
|
|
1635
|
+
try {
|
|
1636
|
+
if (stub) {
|
|
1637
|
+
runCommonAsserts(data, error);
|
|
1638
|
+
assert.equal('63', data.response.product_id);
|
|
1639
|
+
assert.equal('Validation email has been successfully sent', data.response.message);
|
|
1640
|
+
assert.equal(true, data.response.success);
|
|
1641
|
+
} else {
|
|
1642
|
+
runCommonAsserts(data, error);
|
|
1643
|
+
}
|
|
1644
|
+
saveMockData('Validation', 'resendValidationEmail', 'default', data);
|
|
1645
|
+
done();
|
|
1646
|
+
} catch (err) {
|
|
1647
|
+
log.error(`Test Failure: ${err}`);
|
|
1648
|
+
done(err);
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
} catch (error) {
|
|
1652
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1653
|
+
done(error);
|
|
1654
|
+
}
|
|
1655
|
+
}).timeout(attemptTimeout);
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
const invoicesAuthKey = 'fakedata';
|
|
1659
|
+
describe('#getAllInvoices - errors', () => {
|
|
1660
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1661
|
+
try {
|
|
1662
|
+
a.getAllInvoices(invoicesAuthKey, (data, error) => {
|
|
1663
|
+
try {
|
|
1664
|
+
if (stub) {
|
|
1665
|
+
runCommonAsserts(data, error);
|
|
1666
|
+
assert.equal(true, Array.isArray(data.response.invoices));
|
|
1667
|
+
assert.equal(true, data.response.success);
|
|
1668
|
+
} else {
|
|
1669
|
+
runCommonAsserts(data, error);
|
|
1670
|
+
}
|
|
1671
|
+
saveMockData('Invoices', 'getAllInvoices', 'default', data);
|
|
1672
|
+
done();
|
|
1673
|
+
} catch (err) {
|
|
1674
|
+
log.error(`Test Failure: ${err}`);
|
|
1675
|
+
done(err);
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
} catch (error) {
|
|
1679
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1680
|
+
done(error);
|
|
1681
|
+
}
|
|
1682
|
+
}).timeout(attemptTimeout);
|
|
1683
|
+
});
|
|
1684
|
+
|
|
1685
|
+
describe('#getUnpaidInvoices - errors', () => {
|
|
1686
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1687
|
+
try {
|
|
1688
|
+
a.getUnpaidInvoices(invoicesAuthKey, (data, error) => {
|
|
1689
|
+
try {
|
|
1690
|
+
if (stub) {
|
|
1691
|
+
runCommonAsserts(data, error);
|
|
1692
|
+
assert.equal(true, Array.isArray(data.response.invoices));
|
|
1693
|
+
assert.equal(true, data.response.success);
|
|
1694
|
+
} else {
|
|
1695
|
+
runCommonAsserts(data, error);
|
|
1696
|
+
}
|
|
1697
|
+
saveMockData('Invoices', 'getUnpaidInvoices', 'default', data);
|
|
1698
|
+
done();
|
|
1699
|
+
} catch (err) {
|
|
1700
|
+
log.error(`Test Failure: ${err}`);
|
|
1701
|
+
done(err);
|
|
1702
|
+
}
|
|
1703
|
+
});
|
|
1704
|
+
} catch (error) {
|
|
1705
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1706
|
+
done(error);
|
|
1707
|
+
}
|
|
1708
|
+
}).timeout(attemptTimeout);
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
describe('#getOrderInvoice - errors', () => {
|
|
1712
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1713
|
+
try {
|
|
1714
|
+
a.getOrderInvoice(invoicesAuthKey, 'fakedata', (data, error) => {
|
|
1715
|
+
try {
|
|
1716
|
+
if (stub) {
|
|
1717
|
+
runCommonAsserts(data, error);
|
|
1718
|
+
assert.equal('1146748', data.response.orderId);
|
|
1719
|
+
assert.equal('GGS-0719723755', data.response.number);
|
|
1720
|
+
assert.equal('2019-07-23', data.response.date);
|
|
1721
|
+
assert.equal('59.13', data.response.subtotal);
|
|
1722
|
+
assert.equal('12.42', data.response.tax);
|
|
1723
|
+
assert.equal('21.00', data.response.tax_rate);
|
|
1724
|
+
assert.equal('71.55', data.response.total);
|
|
1725
|
+
assert.equal('paid', data.response.status);
|
|
1726
|
+
assert.equal('EUR', data.response.currency);
|
|
1727
|
+
assert.equal('balance', data.response.payment_method);
|
|
1728
|
+
assert.equal(true, data.response.success);
|
|
1729
|
+
} else {
|
|
1730
|
+
runCommonAsserts(data, error);
|
|
1731
|
+
}
|
|
1732
|
+
saveMockData('Invoices', 'getOrderInvoice', 'default', data);
|
|
1733
|
+
done();
|
|
1734
|
+
} catch (err) {
|
|
1735
|
+
log.error(`Test Failure: ${err}`);
|
|
1736
|
+
done(err);
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
} catch (error) {
|
|
1740
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1741
|
+
done(error);
|
|
1742
|
+
}
|
|
1743
|
+
}).timeout(attemptTimeout);
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
});
|