@itentialopensource/adapter-google_drive 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/CHANGELOG.md +9 -0
  5. package/CODE_OF_CONDUCT.md +48 -0
  6. package/CONTRIBUTING.md +158 -0
  7. package/LICENSE +201 -0
  8. package/README.md +687 -0
  9. package/adapter.js +5422 -0
  10. package/adapterBase.js +1028 -0
  11. package/entities/.generic/action.json +109 -0
  12. package/entities/.generic/schema.json +23 -0
  13. package/entities/.system/action.json +50 -0
  14. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  15. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  16. package/entities/.system/schema.json +19 -0
  17. package/entities/.system/schemaTokenReq.json +31 -0
  18. package/entities/.system/schemaTokenResp.json +31 -0
  19. package/entities/About/action.json +25 -0
  20. package/entities/About/schema.json +30 -0
  21. package/entities/Changes/action.json +66 -0
  22. package/entities/Changes/schema.json +32 -0
  23. package/entities/Channels/action.json +24 -0
  24. package/entities/Channels/schema.json +30 -0
  25. package/entities/Comments/action.json +106 -0
  26. package/entities/Comments/schema.json +34 -0
  27. package/entities/Drives/action.json +146 -0
  28. package/entities/Drives/schema.json +36 -0
  29. package/entities/Files/action.json +208 -0
  30. package/entities/Files/schema.json +39 -0
  31. package/entities/Permissions/action.json +106 -0
  32. package/entities/Permissions/schema.json +34 -0
  33. package/entities/Replies/action.json +106 -0
  34. package/entities/Replies/schema.json +34 -0
  35. package/entities/Revisions/action.json +86 -0
  36. package/entities/Revisions/schema.json +33 -0
  37. package/entities/Teamdrives/action.json +106 -0
  38. package/entities/Teamdrives/schema.json +34 -0
  39. package/error.json +184 -0
  40. package/package.json +84 -0
  41. package/pronghorn.json +10981 -0
  42. package/propertiesSchema.json +840 -0
  43. package/refs?service=git-upload-pack +0 -0
  44. package/report/creationReport.json +534 -0
  45. package/report/googledrive.json +6538 -0
  46. package/report/updateReport1647550499630.json +95 -0
  47. package/sampleProperties.json +122 -0
  48. package/storage/metrics.json +41 -0
  49. package/test/integration/adapterTestBasicGet.js +85 -0
  50. package/test/integration/adapterTestConnectivity.js +93 -0
  51. package/test/integration/adapterTestIntegration.js +2966 -0
  52. package/test/unit/adapterBaseTestUnit.js +944 -0
  53. package/test/unit/adapterTestUnit.js +2856 -0
  54. package/utils/addAuth.js +94 -0
  55. package/utils/artifactize.js +146 -0
  56. package/utils/basicGet.js +50 -0
  57. package/utils/checkMigrate.js +63 -0
  58. package/utils/entitiesToDB.js +224 -0
  59. package/utils/findPath.js +74 -0
  60. package/utils/modify.js +154 -0
  61. package/utils/packModificationScript.js +35 -0
  62. package/utils/patches2bundledDeps.js +90 -0
  63. package/utils/pre-commit.sh +27 -0
  64. package/utils/removeHooks.js +20 -0
  65. package/utils/setup.js +33 -0
  66. package/utils/tbScript.js +169 -0
  67. package/utils/tbUtils.js +451 -0
  68. package/utils/testRunner.js +298 -0
  69. package/utils/troubleshootingAdapter.js +190 -0
  70. package/workflows/README.md +3 -0
@@ -0,0 +1,2966 @@
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
+ const util = require('util');
17
+ const pronghorn = require('../../pronghorn.json');
18
+
19
+ pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
20
+ const anything = td.matchers.anything();
21
+
22
+ // stub and attemptTimeout are used throughout the code so set them here
23
+ let logLevel = 'none';
24
+ const stub = true;
25
+ const isRapidFail = false;
26
+ const isSaveMockData = false;
27
+ const attemptTimeout = 5000;
28
+
29
+ // these variables can be changed to run in integrated mode so easier to set them here
30
+ // always check these in with bogus data!!!
31
+ const host = 'replace.hostorip.here';
32
+ const username = 'username';
33
+ const password = 'password';
34
+ const protocol = 'http';
35
+ const port = 80;
36
+ const sslenable = false;
37
+ const sslinvalid = false;
38
+
39
+ // these are the adapter properties. You generally should not need to alter
40
+ // any of these after they are initially set up
41
+ global.pronghornProps = {
42
+ pathProps: {
43
+ encrypted: false
44
+ },
45
+ adapterProps: {
46
+ adapters: [{
47
+ id: 'Test-google_drive',
48
+ type: 'GoogleDrive',
49
+ properties: {
50
+ host,
51
+ port,
52
+ base_path: '/drive/v3',
53
+ version: '',
54
+ cache_location: 'none',
55
+ encode_pathvars: true,
56
+ save_metric: false,
57
+ stub,
58
+ protocol,
59
+ authentication: {
60
+ auth_method: 'no_authentication',
61
+ username,
62
+ password,
63
+ token: '',
64
+ invalid_token_error: 401,
65
+ token_timeout: -1,
66
+ token_cache: 'local',
67
+ auth_field: 'header.headers.Authorization',
68
+ auth_field_format: 'Bearer {token}',
69
+ auth_logging: false,
70
+ client_id: '',
71
+ client_secret: '',
72
+ grant_type: ''
73
+ },
74
+ healthcheck: {
75
+ type: 'intermittent',
76
+ frequency: 600000,
77
+ query_object: {}
78
+ },
79
+ throttle: {
80
+ throttle_enabled: false,
81
+ number_pronghorns: 1,
82
+ sync_async: 'sync',
83
+ max_in_queue: 1000,
84
+ concurrent_max: 1,
85
+ expire_timeout: 0,
86
+ avg_runtime: 200,
87
+ priorities: [
88
+ {
89
+ value: 0,
90
+ percent: 100
91
+ }
92
+ ]
93
+ },
94
+ request: {
95
+ number_redirects: 0,
96
+ number_retries: 3,
97
+ limit_retry_error: [0],
98
+ failover_codes: [],
99
+ attempt_timeout: attemptTimeout,
100
+ global_request: {
101
+ payload: {},
102
+ uriOptions: {},
103
+ addlHeaders: {},
104
+ authData: {}
105
+ },
106
+ healthcheck_on_timeout: true,
107
+ return_raw: true,
108
+ archiving: false,
109
+ return_request: false
110
+ },
111
+ proxy: {
112
+ enabled: false,
113
+ host: '',
114
+ port: 1,
115
+ protocol: 'http',
116
+ username: '',
117
+ password: ''
118
+ },
119
+ ssl: {
120
+ ecdhCurve: '',
121
+ enabled: sslenable,
122
+ accept_invalid_cert: sslinvalid,
123
+ ca_file: '',
124
+ key_file: '',
125
+ cert_file: '',
126
+ secure_protocol: '',
127
+ ciphers: ''
128
+ },
129
+ mongo: {
130
+ host: '',
131
+ port: 0,
132
+ database: '',
133
+ username: '',
134
+ password: '',
135
+ replSet: '',
136
+ db_ssl: {
137
+ enabled: false,
138
+ accept_invalid_cert: false,
139
+ ca_file: '',
140
+ key_file: '',
141
+ cert_file: ''
142
+ }
143
+ }
144
+ }
145
+ }]
146
+ }
147
+ };
148
+
149
+ global.$HOME = `${__dirname}/../..`;
150
+
151
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
152
+ // this you may error on log.trace calls.
153
+ const myCustomLevels = {
154
+ levels: {
155
+ spam: 6,
156
+ trace: 5,
157
+ debug: 4,
158
+ info: 3,
159
+ warn: 2,
160
+ error: 1,
161
+ none: 0
162
+ }
163
+ };
164
+
165
+ // need to see if there is a log level passed in
166
+ process.argv.forEach((val) => {
167
+ // is there a log level defined to be passed in?
168
+ if (val.indexOf('--LOG') === 0) {
169
+ // get the desired log level
170
+ const inputVal = val.split('=')[1];
171
+
172
+ // validate the log level is supported, if so set it
173
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
174
+ logLevel = inputVal;
175
+ }
176
+ }
177
+ });
178
+
179
+ // need to set global logging
180
+ global.log = winston.createLogger({
181
+ level: logLevel,
182
+ levels: myCustomLevels.levels,
183
+ transports: [
184
+ new winston.transports.Console()
185
+ ]
186
+ });
187
+
188
+ /**
189
+ * Runs the common asserts for test
190
+ */
191
+ function runCommonAsserts(data, error) {
192
+ assert.equal(undefined, error);
193
+ assert.notEqual(undefined, data);
194
+ assert.notEqual(null, data);
195
+ assert.notEqual(undefined, data.response);
196
+ assert.notEqual(null, data.response);
197
+ }
198
+
199
+ /**
200
+ * Runs the error asserts for the test
201
+ */
202
+ function runErrorAsserts(data, error, code, origin, displayStr) {
203
+ assert.equal(null, data);
204
+ assert.notEqual(undefined, error);
205
+ assert.notEqual(null, error);
206
+ assert.notEqual(undefined, error.IAPerror);
207
+ assert.notEqual(null, error.IAPerror);
208
+ assert.notEqual(undefined, error.IAPerror.displayString);
209
+ assert.notEqual(null, error.IAPerror.displayString);
210
+ assert.equal(code, error.icode);
211
+ assert.equal(origin, error.IAPerror.origin);
212
+ assert.equal(displayStr, error.IAPerror.displayString);
213
+ }
214
+
215
+ /**
216
+ * @function saveMockData
217
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
218
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
219
+ * @param {string} entityName - Name of the entity saving mock data for
220
+ * @param {string} actionName - Name of the action saving mock data for
221
+ * @param {string} descriptor - Something to describe this test (used as a type)
222
+ * @param {string or object} responseData - The data to put in the mock file.
223
+ */
224
+ function saveMockData(entityName, actionName, descriptor, responseData) {
225
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
226
+ if (stub || !isSaveMockData) {
227
+ return false;
228
+ }
229
+
230
+ // must have a response in order to store the response
231
+ if (responseData && responseData.response) {
232
+ let data = responseData.response;
233
+
234
+ // if there was a raw response that one is better as it is untranslated
235
+ if (responseData.raw) {
236
+ data = responseData.raw;
237
+
238
+ try {
239
+ const temp = JSON.parse(data);
240
+ data = temp;
241
+ } catch (pex) {
242
+ // do not care if it did not parse as we will just use data
243
+ }
244
+ }
245
+
246
+ try {
247
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
248
+ const mockdatafolder = 'mockdatafiles';
249
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
250
+
251
+ if (!fs.existsSync(base + mockdatafolder)) {
252
+ fs.mkdirSync(base + mockdatafolder);
253
+ }
254
+
255
+ // write the data we retrieved
256
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
257
+ if (errWritingMock) throw errWritingMock;
258
+
259
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
260
+ fs.readFile(`${base}action.json`, (errRead, content) => {
261
+ if (errRead) throw errRead;
262
+
263
+ // parse the action file into JSON
264
+ const parsedJson = JSON.parse(content);
265
+
266
+ // The object update we'll write in.
267
+ const responseObj = {
268
+ type: descriptor,
269
+ key: '',
270
+ mockFile: filename
271
+ };
272
+
273
+ // get the object for method we're trying to change.
274
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
275
+
276
+ // if the method was not found - should never happen but...
277
+ if (!currentMethodAction) {
278
+ throw Error('Can\'t find an action for this method in the provided entity.');
279
+ }
280
+
281
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
282
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
283
+
284
+ // Add the action responseObj back into the array of response objects.
285
+ if (!actionResponseObj) {
286
+ // if there is a default response object, we want to get the key.
287
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
288
+
289
+ // save the default key into the new response object
290
+ if (defaultResponseObj) {
291
+ responseObj.key = defaultResponseObj.key;
292
+ }
293
+
294
+ // save the new response object
295
+ currentMethodAction.responseObjects = [responseObj];
296
+ } else {
297
+ // update the location of the mock data file
298
+ actionResponseObj.mockFile = responseObj.mockFile;
299
+ }
300
+
301
+ // Save results
302
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
303
+ if (err) throw err;
304
+ });
305
+ });
306
+ });
307
+ } catch (e) {
308
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
309
+ return false;
310
+ }
311
+ }
312
+
313
+ // no response to save
314
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
315
+ return false;
316
+ }
317
+
318
+ // require the adapter that we are going to be using
319
+ const GoogleDrive = require('../../adapter');
320
+
321
+ // begin the testing - these should be pretty well defined between the describe and the it!
322
+ describe('[integration] Google_drive Adapter Test', () => {
323
+ describe('GoogleDrive Class Tests', () => {
324
+ const a = new GoogleDrive(
325
+ pronghornProps.adapterProps.adapters[0].id,
326
+ pronghornProps.adapterProps.adapters[0].properties
327
+ );
328
+
329
+ if (isRapidFail) {
330
+ const state = {};
331
+ state.passed = true;
332
+
333
+ mocha.afterEach(function x() {
334
+ state.passed = state.passed
335
+ && (this.currentTest.state === 'passed');
336
+ });
337
+ mocha.beforeEach(function x() {
338
+ if (!state.passed) {
339
+ return this.currentTest.skip();
340
+ }
341
+ return true;
342
+ });
343
+ }
344
+
345
+ describe('#class instance created', () => {
346
+ it('should be a class with properties', (done) => {
347
+ try {
348
+ assert.notEqual(null, a);
349
+ assert.notEqual(undefined, a);
350
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
351
+ assert.equal(checkId, a.id);
352
+ assert.notEqual(null, a.allProps);
353
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
354
+ assert.equal(check, a.healthcheckType);
355
+ done();
356
+ } catch (error) {
357
+ log.error(`Test Failure: ${error}`);
358
+ done(error);
359
+ }
360
+ }).timeout(attemptTimeout);
361
+ });
362
+
363
+ describe('#connect', () => {
364
+ it('should get connected - no healthcheck', (done) => {
365
+ try {
366
+ a.healthcheckType = 'none';
367
+ a.connect();
368
+
369
+ try {
370
+ assert.equal(true, a.alive);
371
+ done();
372
+ } catch (error) {
373
+ log.error(`Test Failure: ${error}`);
374
+ done(error);
375
+ }
376
+ } catch (error) {
377
+ log.error(`Adapter Exception: ${error}`);
378
+ done(error);
379
+ }
380
+ });
381
+ it('should get connected - startup healthcheck', (done) => {
382
+ try {
383
+ a.healthcheckType = 'startup';
384
+ a.connect();
385
+
386
+ try {
387
+ assert.equal(true, a.alive);
388
+ done();
389
+ } catch (error) {
390
+ log.error(`Test Failure: ${error}`);
391
+ done(error);
392
+ }
393
+ } catch (error) {
394
+ log.error(`Adapter Exception: ${error}`);
395
+ done(error);
396
+ }
397
+ });
398
+ });
399
+
400
+ describe('#healthCheck', () => {
401
+ it('should be healthy', (done) => {
402
+ try {
403
+ a.healthCheck(null, (data) => {
404
+ try {
405
+ assert.equal(true, a.healthy);
406
+ saveMockData('system', 'healthcheck', 'default', data);
407
+ done();
408
+ } catch (err) {
409
+ log.error(`Test Failure: ${err}`);
410
+ done(err);
411
+ }
412
+ });
413
+ } catch (error) {
414
+ log.error(`Adapter Exception: ${error}`);
415
+ done(error);
416
+ }
417
+ }).timeout(attemptTimeout);
418
+ });
419
+
420
+ /*
421
+ -----------------------------------------------------------------------
422
+ -----------------------------------------------------------------------
423
+ *** All code above this comment will be replaced during a migration ***
424
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
425
+ -----------------------------------------------------------------------
426
+ -----------------------------------------------------------------------
427
+ */
428
+ let skipCount = 0;
429
+
430
+ describe('#driveAboutGet - errors', () => {
431
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
432
+ if (pronghorn.methodsByName.driveAboutGet.task) {
433
+ try {
434
+ a.driveAboutGet(null, null, null, null, null, null, null, (data, error) => {
435
+ try {
436
+ if (stub) {
437
+ const displayE = 'Error 400 received on request';
438
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
439
+ } else {
440
+ runCommonAsserts(data, error);
441
+ }
442
+ saveMockData('About', 'driveAboutGet', 'default', data);
443
+ done();
444
+ } catch (err) {
445
+ log.error(`Test Failure: ${err}`);
446
+ done(err);
447
+ }
448
+ });
449
+ } catch (error) {
450
+ log.error(`Adapter Exception: ${error}`);
451
+ done(error);
452
+ }
453
+ } else {
454
+ log.error('driveAboutGet task is false, skipping test');
455
+ skipCount += 1;
456
+ done();
457
+ }// end if task
458
+ }).timeout(attemptTimeout);
459
+ });
460
+
461
+ const changesPageToken = 'fakedata';
462
+ const changesDriveChangesWatchBodyParam = {
463
+ address: 'string',
464
+ expiration: 'string',
465
+ id: 'string',
466
+ kind: 'api#channel',
467
+ params: {},
468
+ payload: true,
469
+ resourceId: 'string',
470
+ resourceUri: 'string',
471
+ token: 'string',
472
+ type: 'string'
473
+ };
474
+ describe('#driveChangesWatch - errors', () => {
475
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
476
+ if (pronghorn.methodsByName.driveChangesWatch.task) {
477
+ try {
478
+ a.driveChangesWatch(null, null, null, null, null, null, null, changesPageToken, null, null, null, null, null, null, null, null, null, null, null, null, changesDriveChangesWatchBodyParam, (data, error) => {
479
+ try {
480
+ if (stub) {
481
+ const displayE = 'Error 400 received on request';
482
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
483
+ } else {
484
+ runCommonAsserts(data, error);
485
+ }
486
+ saveMockData('Changes', 'driveChangesWatch', 'default', data);
487
+ done();
488
+ } catch (err) {
489
+ log.error(`Test Failure: ${err}`);
490
+ done(err);
491
+ }
492
+ });
493
+ } catch (error) {
494
+ log.error(`Adapter Exception: ${error}`);
495
+ done(error);
496
+ }
497
+ } else {
498
+ log.error('driveChangesWatch task is false, skipping test');
499
+ skipCount += 1;
500
+ done();
501
+ }// end if task
502
+ }).timeout(attemptTimeout);
503
+ });
504
+
505
+ describe('#driveChangesList - errors', () => {
506
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
507
+ if (pronghorn.methodsByName.driveChangesList.task) {
508
+ try {
509
+ a.driveChangesList(null, null, null, null, null, null, null, changesPageToken, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
510
+ try {
511
+ if (stub) {
512
+ const displayE = 'Error 400 received on request';
513
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
514
+ } else {
515
+ runCommonAsserts(data, error);
516
+ }
517
+ saveMockData('Changes', 'driveChangesList', '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
+ } else {
529
+ log.error('driveChangesList task is false, skipping test');
530
+ skipCount += 1;
531
+ done();
532
+ }// end if task
533
+ }).timeout(attemptTimeout);
534
+ });
535
+
536
+ describe('#driveChangesGetStartPageToken - errors', () => {
537
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
538
+ if (pronghorn.methodsByName.driveChangesGetStartPageToken.task) {
539
+ try {
540
+ a.driveChangesGetStartPageToken(null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
541
+ try {
542
+ if (stub) {
543
+ const displayE = 'Error 400 received on request';
544
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
545
+ } else {
546
+ runCommonAsserts(data, error);
547
+ }
548
+ saveMockData('Changes', 'driveChangesGetStartPageToken', 'default', data);
549
+ done();
550
+ } catch (err) {
551
+ log.error(`Test Failure: ${err}`);
552
+ done(err);
553
+ }
554
+ });
555
+ } catch (error) {
556
+ log.error(`Adapter Exception: ${error}`);
557
+ done(error);
558
+ }
559
+ } else {
560
+ log.error('driveChangesGetStartPageToken task is false, skipping test');
561
+ skipCount += 1;
562
+ done();
563
+ }// end if task
564
+ }).timeout(attemptTimeout);
565
+ });
566
+
567
+ const channelsDriveChannelsStopBodyParam = {
568
+ address: 'string',
569
+ expiration: 'string',
570
+ id: 'string',
571
+ kind: 'api#channel',
572
+ params: {},
573
+ payload: true,
574
+ resourceId: 'string',
575
+ resourceUri: 'string',
576
+ token: 'string',
577
+ type: 'string'
578
+ };
579
+ describe('#driveChannelsStop - errors', () => {
580
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
581
+ if (pronghorn.methodsByName.driveChannelsStop.task) {
582
+ try {
583
+ a.driveChannelsStop(null, null, null, null, null, null, null, channelsDriveChannelsStopBodyParam, (data, error) => {
584
+ try {
585
+ if (stub) {
586
+ const displayE = 'Error 400 received on request';
587
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
588
+ } else {
589
+ runCommonAsserts(data, error);
590
+ }
591
+ saveMockData('Channels', 'driveChannelsStop', 'default', data);
592
+ done();
593
+ } catch (err) {
594
+ log.error(`Test Failure: ${err}`);
595
+ done(err);
596
+ }
597
+ });
598
+ } catch (error) {
599
+ log.error(`Adapter Exception: ${error}`);
600
+ done(error);
601
+ }
602
+ } else {
603
+ log.error('driveChannelsStop task is false, skipping test');
604
+ skipCount += 1;
605
+ done();
606
+ }// end if task
607
+ }).timeout(attemptTimeout);
608
+ });
609
+
610
+ const drivesRequestId = 'fakedata';
611
+ const drivesDriveDrivesCreateBodyParam = {
612
+ backgroundImageFile: {
613
+ id: 'string',
614
+ width: 7,
615
+ xCoordinate: 9,
616
+ yCoordinate: 6
617
+ },
618
+ backgroundImageLink: 'string',
619
+ capabilities: {
620
+ canAddChildren: true,
621
+ canChangeCopyRequiresWriterPermissionRestriction: true,
622
+ canChangeDomainUsersOnlyRestriction: true,
623
+ canChangeDriveBackground: true,
624
+ canChangeDriveMembersOnlyRestriction: true,
625
+ canComment: true,
626
+ canCopy: false,
627
+ canDeleteChildren: false,
628
+ canDeleteDrive: false,
629
+ canDownload: true,
630
+ canEdit: true,
631
+ canListChildren: true,
632
+ canManageMembers: true,
633
+ canReadRevisions: false,
634
+ canRename: true,
635
+ canRenameDrive: true,
636
+ canShare: true,
637
+ canTrashChildren: true
638
+ },
639
+ colorRgb: 'string',
640
+ createdTime: 'string',
641
+ hidden: true,
642
+ id: 'string',
643
+ kind: 'drive#drive',
644
+ name: 'string',
645
+ orgUnitId: 'string',
646
+ restrictions: {
647
+ adminManagedRestrictions: true,
648
+ copyRequiresWriterPermission: true,
649
+ domainUsersOnly: true,
650
+ driveMembersOnly: false
651
+ },
652
+ themeId: 'string'
653
+ };
654
+ describe('#driveDrivesCreate - errors', () => {
655
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
656
+ if (pronghorn.methodsByName.driveDrivesCreate.task) {
657
+ try {
658
+ a.driveDrivesCreate(null, null, null, null, null, null, null, drivesRequestId, drivesDriveDrivesCreateBodyParam, (data, error) => {
659
+ try {
660
+ if (stub) {
661
+ const displayE = 'Error 400 received on request';
662
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
663
+ } else {
664
+ runCommonAsserts(data, error);
665
+ }
666
+ saveMockData('Drives', 'driveDrivesCreate', 'default', data);
667
+ done();
668
+ } catch (err) {
669
+ log.error(`Test Failure: ${err}`);
670
+ done(err);
671
+ }
672
+ });
673
+ } catch (error) {
674
+ log.error(`Adapter Exception: ${error}`);
675
+ done(error);
676
+ }
677
+ } else {
678
+ log.error('driveDrivesCreate task is false, skipping test');
679
+ skipCount += 1;
680
+ done();
681
+ }// end if task
682
+ }).timeout(attemptTimeout);
683
+ });
684
+
685
+ const drivesDriveId = 'fakedata';
686
+ describe('#driveDrivesHide - errors', () => {
687
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
688
+ if (pronghorn.methodsByName.driveDrivesHide.task) {
689
+ try {
690
+ a.driveDrivesHide(null, null, null, null, null, null, null, drivesDriveId, (data, error) => {
691
+ try {
692
+ if (stub) {
693
+ const displayE = 'Error 400 received on request';
694
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
695
+ } else {
696
+ runCommonAsserts(data, error);
697
+ }
698
+ saveMockData('Drives', 'driveDrivesHide', 'default', data);
699
+ done();
700
+ } catch (err) {
701
+ log.error(`Test Failure: ${err}`);
702
+ done(err);
703
+ }
704
+ });
705
+ } catch (error) {
706
+ log.error(`Adapter Exception: ${error}`);
707
+ done(error);
708
+ }
709
+ } else {
710
+ log.error('driveDrivesHide task is false, skipping test');
711
+ skipCount += 1;
712
+ done();
713
+ }// end if task
714
+ }).timeout(attemptTimeout);
715
+ });
716
+
717
+ describe('#driveDrivesUnhide - errors', () => {
718
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
719
+ if (pronghorn.methodsByName.driveDrivesUnhide.task) {
720
+ try {
721
+ a.driveDrivesUnhide(null, null, null, null, null, null, null, drivesDriveId, (data, error) => {
722
+ try {
723
+ if (stub) {
724
+ const displayE = 'Error 400 received on request';
725
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
726
+ } else {
727
+ runCommonAsserts(data, error);
728
+ }
729
+ saveMockData('Drives', 'driveDrivesUnhide', 'default', data);
730
+ done();
731
+ } catch (err) {
732
+ log.error(`Test Failure: ${err}`);
733
+ done(err);
734
+ }
735
+ });
736
+ } catch (error) {
737
+ log.error(`Adapter Exception: ${error}`);
738
+ done(error);
739
+ }
740
+ } else {
741
+ log.error('driveDrivesUnhide task is false, skipping test');
742
+ skipCount += 1;
743
+ done();
744
+ }// end if task
745
+ }).timeout(attemptTimeout);
746
+ });
747
+
748
+ describe('#driveDrivesList - errors', () => {
749
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
750
+ if (pronghorn.methodsByName.driveDrivesList.task) {
751
+ try {
752
+ a.driveDrivesList(null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
753
+ try {
754
+ if (stub) {
755
+ const displayE = 'Error 400 received on request';
756
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
757
+ } else {
758
+ runCommonAsserts(data, error);
759
+ }
760
+ saveMockData('Drives', 'driveDrivesList', 'default', data);
761
+ done();
762
+ } catch (err) {
763
+ log.error(`Test Failure: ${err}`);
764
+ done(err);
765
+ }
766
+ });
767
+ } catch (error) {
768
+ log.error(`Adapter Exception: ${error}`);
769
+ done(error);
770
+ }
771
+ } else {
772
+ log.error('driveDrivesList task is false, skipping test');
773
+ skipCount += 1;
774
+ done();
775
+ }// end if task
776
+ }).timeout(attemptTimeout);
777
+ });
778
+
779
+ const drivesDriveDrivesUpdateBodyParam = {
780
+ backgroundImageFile: {
781
+ id: 'string',
782
+ width: 5,
783
+ xCoordinate: 2,
784
+ yCoordinate: 2
785
+ },
786
+ backgroundImageLink: 'string',
787
+ capabilities: {
788
+ canAddChildren: false,
789
+ canChangeCopyRequiresWriterPermissionRestriction: false,
790
+ canChangeDomainUsersOnlyRestriction: false,
791
+ canChangeDriveBackground: false,
792
+ canChangeDriveMembersOnlyRestriction: true,
793
+ canComment: false,
794
+ canCopy: false,
795
+ canDeleteChildren: true,
796
+ canDeleteDrive: false,
797
+ canDownload: false,
798
+ canEdit: true,
799
+ canListChildren: true,
800
+ canManageMembers: false,
801
+ canReadRevisions: true,
802
+ canRename: true,
803
+ canRenameDrive: true,
804
+ canShare: false,
805
+ canTrashChildren: false
806
+ },
807
+ colorRgb: 'string',
808
+ createdTime: 'string',
809
+ hidden: true,
810
+ id: 'string',
811
+ kind: 'drive#drive',
812
+ name: 'string',
813
+ orgUnitId: 'string',
814
+ restrictions: {
815
+ adminManagedRestrictions: false,
816
+ copyRequiresWriterPermission: true,
817
+ domainUsersOnly: true,
818
+ driveMembersOnly: false
819
+ },
820
+ themeId: 'string'
821
+ };
822
+ describe('#driveDrivesUpdate - errors', () => {
823
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
824
+ if (pronghorn.methodsByName.driveDrivesUpdate.task) {
825
+ try {
826
+ a.driveDrivesUpdate(null, null, null, null, null, null, null, drivesDriveId, null, drivesDriveDrivesUpdateBodyParam, (data, error) => {
827
+ try {
828
+ if (stub) {
829
+ const displayE = 'Error 400 received on request';
830
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
831
+ } else {
832
+ runCommonAsserts(data, error);
833
+ }
834
+ saveMockData('Drives', 'driveDrivesUpdate', 'default', data);
835
+ done();
836
+ } catch (err) {
837
+ log.error(`Test Failure: ${err}`);
838
+ done(err);
839
+ }
840
+ });
841
+ } catch (error) {
842
+ log.error(`Adapter Exception: ${error}`);
843
+ done(error);
844
+ }
845
+ } else {
846
+ log.error('driveDrivesUpdate task is false, skipping test');
847
+ skipCount += 1;
848
+ done();
849
+ }// end if task
850
+ }).timeout(attemptTimeout);
851
+ });
852
+
853
+ describe('#driveDrivesGet - errors', () => {
854
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
855
+ if (pronghorn.methodsByName.driveDrivesGet.task) {
856
+ try {
857
+ a.driveDrivesGet(null, null, null, null, null, null, null, drivesDriveId, null, (data, error) => {
858
+ try {
859
+ if (stub) {
860
+ const displayE = 'Error 400 received on request';
861
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
862
+ } else {
863
+ runCommonAsserts(data, error);
864
+ }
865
+ saveMockData('Drives', 'driveDrivesGet', 'default', data);
866
+ done();
867
+ } catch (err) {
868
+ log.error(`Test Failure: ${err}`);
869
+ done(err);
870
+ }
871
+ });
872
+ } catch (error) {
873
+ log.error(`Adapter Exception: ${error}`);
874
+ done(error);
875
+ }
876
+ } else {
877
+ log.error('driveDrivesGet task is false, skipping test');
878
+ skipCount += 1;
879
+ done();
880
+ }// end if task
881
+ }).timeout(attemptTimeout);
882
+ });
883
+
884
+ const filesDriveFilesCreateBodyParam = {
885
+ appProperties: {},
886
+ capabilities: {
887
+ canAcceptOwnership: false,
888
+ canAddChildren: false,
889
+ canAddFolderFromAnotherDrive: true,
890
+ canAddMyDriveParent: true,
891
+ canChangeCopyRequiresWriterPermission: true,
892
+ canChangeSecurityUpdateEnabled: true,
893
+ canChangeViewersCanCopyContent: false,
894
+ canComment: false,
895
+ canCopy: true,
896
+ canDelete: true,
897
+ canDeleteChildren: false,
898
+ canDownload: false,
899
+ canEdit: false,
900
+ canListChildren: false,
901
+ canModifyContent: false,
902
+ canModifyContentRestriction: false,
903
+ canMoveChildrenOutOfDrive: true,
904
+ canMoveChildrenOutOfTeamDrive: false,
905
+ canMoveChildrenWithinDrive: true,
906
+ canMoveChildrenWithinTeamDrive: true,
907
+ canMoveItemIntoTeamDrive: true,
908
+ canMoveItemOutOfDrive: true,
909
+ canMoveItemOutOfTeamDrive: false,
910
+ canMoveItemWithinDrive: true,
911
+ canMoveItemWithinTeamDrive: true,
912
+ canMoveTeamDriveItem: true,
913
+ canReadDrive: false,
914
+ canReadRevisions: false,
915
+ canReadTeamDrive: true,
916
+ canRemoveChildren: false,
917
+ canRemoveMyDriveParent: false,
918
+ canRename: true,
919
+ canShare: true,
920
+ canTrash: false,
921
+ canTrashChildren: true,
922
+ canUntrash: false
923
+ },
924
+ contentHints: {
925
+ indexableText: 'string',
926
+ thumbnail: {
927
+ image: 'string',
928
+ mimeType: 'string'
929
+ }
930
+ },
931
+ contentRestrictions: [
932
+ {
933
+ readOnly: false,
934
+ reason: 'string',
935
+ restrictingUser: {
936
+ displayName: 'string',
937
+ emailAddress: 'string',
938
+ kind: 'drive#user',
939
+ me: false,
940
+ permissionId: 'string',
941
+ photoLink: 'string'
942
+ },
943
+ restrictionTime: 'string',
944
+ type: 'string'
945
+ }
946
+ ],
947
+ copyRequiresWriterPermission: false,
948
+ createdTime: 'string',
949
+ description: 'string',
950
+ driveId: 'string',
951
+ explicitlyTrashed: false,
952
+ exportLinks: {},
953
+ fileExtension: 'string',
954
+ folderColorRgb: 'string',
955
+ fullFileExtension: 'string',
956
+ hasAugmentedPermissions: false,
957
+ hasThumbnail: false,
958
+ headRevisionId: 'string',
959
+ iconLink: 'string',
960
+ id: 'string',
961
+ imageMediaMetadata: {
962
+ aperture: 1,
963
+ cameraMake: 'string',
964
+ cameraModel: 'string',
965
+ colorSpace: 'string',
966
+ exposureBias: 2,
967
+ exposureMode: 'string',
968
+ exposureTime: 1,
969
+ flashUsed: true,
970
+ focalLength: 6,
971
+ height: 2,
972
+ isoSpeed: 2,
973
+ lens: 'string',
974
+ location: {
975
+ altitude: 1,
976
+ latitude: 10,
977
+ longitude: 3
978
+ },
979
+ maxApertureValue: 10,
980
+ meteringMode: 'string',
981
+ rotation: 3,
982
+ sensor: 'string',
983
+ subjectDistance: 5,
984
+ time: 'string',
985
+ whiteBalance: 'string',
986
+ width: 10
987
+ },
988
+ isAppAuthorized: false,
989
+ kind: 'drive#file',
990
+ lastModifyingUser: {
991
+ displayName: 'string',
992
+ emailAddress: 'string',
993
+ kind: 'drive#user',
994
+ me: false,
995
+ permissionId: 'string',
996
+ photoLink: 'string'
997
+ },
998
+ linkShareMetadata: {
999
+ securityUpdateEligible: false,
1000
+ securityUpdateEnabled: true
1001
+ },
1002
+ md5Checksum: 'string',
1003
+ mimeType: 'string',
1004
+ modifiedByMe: false,
1005
+ modifiedByMeTime: 'string',
1006
+ modifiedTime: 'string',
1007
+ name: 'string',
1008
+ originalFilename: 'string',
1009
+ ownedByMe: false,
1010
+ owners: [
1011
+ {
1012
+ displayName: 'string',
1013
+ emailAddress: 'string',
1014
+ kind: 'drive#user',
1015
+ me: false,
1016
+ permissionId: 'string',
1017
+ photoLink: 'string'
1018
+ }
1019
+ ],
1020
+ parents: [
1021
+ 'string'
1022
+ ],
1023
+ permissionIds: [
1024
+ 'string'
1025
+ ],
1026
+ permissions: [
1027
+ {
1028
+ allowFileDiscovery: true,
1029
+ deleted: false,
1030
+ displayName: 'string',
1031
+ domain: 'string',
1032
+ emailAddress: 'string',
1033
+ expirationTime: 'string',
1034
+ id: 'string',
1035
+ kind: 'drive#permission',
1036
+ pendingOwner: true,
1037
+ permissionDetails: [
1038
+ {
1039
+ inherited: true,
1040
+ inheritedFrom: 'string',
1041
+ permissionType: 'string',
1042
+ role: 'string'
1043
+ }
1044
+ ],
1045
+ photoLink: 'string',
1046
+ role: 'string',
1047
+ teamDrivePermissionDetails: [
1048
+ {
1049
+ inherited: true,
1050
+ inheritedFrom: 'string',
1051
+ role: 'string',
1052
+ teamDrivePermissionType: 'string'
1053
+ }
1054
+ ],
1055
+ type: 'string',
1056
+ view: 'string'
1057
+ }
1058
+ ],
1059
+ properties: {},
1060
+ quotaBytesUsed: 'string',
1061
+ resourceKey: 'string',
1062
+ shared: true,
1063
+ sharedWithMeTime: 'string',
1064
+ sharingUser: {
1065
+ displayName: 'string',
1066
+ emailAddress: 'string',
1067
+ kind: 'drive#user',
1068
+ me: false,
1069
+ permissionId: 'string',
1070
+ photoLink: 'string'
1071
+ },
1072
+ shortcutDetails: {
1073
+ targetId: 'string',
1074
+ targetMimeType: 'string',
1075
+ targetResourceKey: 'string'
1076
+ },
1077
+ size: 'string',
1078
+ spaces: [
1079
+ 'string'
1080
+ ],
1081
+ starred: true,
1082
+ teamDriveId: 'string',
1083
+ thumbnailLink: 'string',
1084
+ thumbnailVersion: 'string',
1085
+ trashed: false,
1086
+ trashedTime: 'string',
1087
+ trashingUser: {
1088
+ displayName: 'string',
1089
+ emailAddress: 'string',
1090
+ kind: 'drive#user',
1091
+ me: true,
1092
+ permissionId: 'string',
1093
+ photoLink: 'string'
1094
+ },
1095
+ version: 'string',
1096
+ videoMediaMetadata: {
1097
+ durationMillis: 'string',
1098
+ height: 8,
1099
+ width: 8
1100
+ },
1101
+ viewedByMe: false,
1102
+ viewedByMeTime: 'string',
1103
+ viewersCanCopyContent: true,
1104
+ webContentLink: 'string',
1105
+ webViewLink: 'string',
1106
+ writersCanShare: false
1107
+ };
1108
+ describe('#driveFilesCreate - errors', () => {
1109
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1110
+ if (pronghorn.methodsByName.driveFilesCreate.task) {
1111
+ try {
1112
+ a.driveFilesCreate(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, filesDriveFilesCreateBodyParam, (data, error) => {
1113
+ try {
1114
+ if (stub) {
1115
+ const displayE = 'Error 400 received on request';
1116
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1117
+ } else {
1118
+ runCommonAsserts(data, error);
1119
+ }
1120
+ saveMockData('Files', 'driveFilesCreate', 'default', data);
1121
+ done();
1122
+ } catch (err) {
1123
+ log.error(`Test Failure: ${err}`);
1124
+ done(err);
1125
+ }
1126
+ });
1127
+ } catch (error) {
1128
+ log.error(`Adapter Exception: ${error}`);
1129
+ done(error);
1130
+ }
1131
+ } else {
1132
+ log.error('driveFilesCreate task is false, skipping test');
1133
+ skipCount += 1;
1134
+ done();
1135
+ }// end if task
1136
+ }).timeout(attemptTimeout);
1137
+ });
1138
+
1139
+ const filesFileId = 'fakedata';
1140
+ const filesDriveFilesCopyBodyParam = {
1141
+ appProperties: {},
1142
+ capabilities: {
1143
+ canAcceptOwnership: false,
1144
+ canAddChildren: true,
1145
+ canAddFolderFromAnotherDrive: false,
1146
+ canAddMyDriveParent: false,
1147
+ canChangeCopyRequiresWriterPermission: false,
1148
+ canChangeSecurityUpdateEnabled: false,
1149
+ canChangeViewersCanCopyContent: false,
1150
+ canComment: true,
1151
+ canCopy: true,
1152
+ canDelete: false,
1153
+ canDeleteChildren: false,
1154
+ canDownload: false,
1155
+ canEdit: true,
1156
+ canListChildren: false,
1157
+ canModifyContent: false,
1158
+ canModifyContentRestriction: true,
1159
+ canMoveChildrenOutOfDrive: true,
1160
+ canMoveChildrenOutOfTeamDrive: true,
1161
+ canMoveChildrenWithinDrive: false,
1162
+ canMoveChildrenWithinTeamDrive: false,
1163
+ canMoveItemIntoTeamDrive: false,
1164
+ canMoveItemOutOfDrive: false,
1165
+ canMoveItemOutOfTeamDrive: true,
1166
+ canMoveItemWithinDrive: true,
1167
+ canMoveItemWithinTeamDrive: true,
1168
+ canMoveTeamDriveItem: false,
1169
+ canReadDrive: false,
1170
+ canReadRevisions: true,
1171
+ canReadTeamDrive: true,
1172
+ canRemoveChildren: false,
1173
+ canRemoveMyDriveParent: false,
1174
+ canRename: false,
1175
+ canShare: false,
1176
+ canTrash: false,
1177
+ canTrashChildren: false,
1178
+ canUntrash: true
1179
+ },
1180
+ contentHints: {
1181
+ indexableText: 'string',
1182
+ thumbnail: {
1183
+ image: 'string',
1184
+ mimeType: 'string'
1185
+ }
1186
+ },
1187
+ contentRestrictions: [
1188
+ {
1189
+ readOnly: true,
1190
+ reason: 'string',
1191
+ restrictingUser: {
1192
+ displayName: 'string',
1193
+ emailAddress: 'string',
1194
+ kind: 'drive#user',
1195
+ me: false,
1196
+ permissionId: 'string',
1197
+ photoLink: 'string'
1198
+ },
1199
+ restrictionTime: 'string',
1200
+ type: 'string'
1201
+ }
1202
+ ],
1203
+ copyRequiresWriterPermission: true,
1204
+ createdTime: 'string',
1205
+ description: 'string',
1206
+ driveId: 'string',
1207
+ explicitlyTrashed: true,
1208
+ exportLinks: {},
1209
+ fileExtension: 'string',
1210
+ folderColorRgb: 'string',
1211
+ fullFileExtension: 'string',
1212
+ hasAugmentedPermissions: true,
1213
+ hasThumbnail: false,
1214
+ headRevisionId: 'string',
1215
+ iconLink: 'string',
1216
+ id: 'string',
1217
+ imageMediaMetadata: {
1218
+ aperture: 2,
1219
+ cameraMake: 'string',
1220
+ cameraModel: 'string',
1221
+ colorSpace: 'string',
1222
+ exposureBias: 7,
1223
+ exposureMode: 'string',
1224
+ exposureTime: 3,
1225
+ flashUsed: false,
1226
+ focalLength: 7,
1227
+ height: 3,
1228
+ isoSpeed: 1,
1229
+ lens: 'string',
1230
+ location: {
1231
+ altitude: 3,
1232
+ latitude: 6,
1233
+ longitude: 8
1234
+ },
1235
+ maxApertureValue: 6,
1236
+ meteringMode: 'string',
1237
+ rotation: 4,
1238
+ sensor: 'string',
1239
+ subjectDistance: 3,
1240
+ time: 'string',
1241
+ whiteBalance: 'string',
1242
+ width: 7
1243
+ },
1244
+ isAppAuthorized: true,
1245
+ kind: 'drive#file',
1246
+ lastModifyingUser: {
1247
+ displayName: 'string',
1248
+ emailAddress: 'string',
1249
+ kind: 'drive#user',
1250
+ me: false,
1251
+ permissionId: 'string',
1252
+ photoLink: 'string'
1253
+ },
1254
+ linkShareMetadata: {
1255
+ securityUpdateEligible: true,
1256
+ securityUpdateEnabled: true
1257
+ },
1258
+ md5Checksum: 'string',
1259
+ mimeType: 'string',
1260
+ modifiedByMe: false,
1261
+ modifiedByMeTime: 'string',
1262
+ modifiedTime: 'string',
1263
+ name: 'string',
1264
+ originalFilename: 'string',
1265
+ ownedByMe: false,
1266
+ owners: [
1267
+ {
1268
+ displayName: 'string',
1269
+ emailAddress: 'string',
1270
+ kind: 'drive#user',
1271
+ me: true,
1272
+ permissionId: 'string',
1273
+ photoLink: 'string'
1274
+ }
1275
+ ],
1276
+ parents: [
1277
+ 'string'
1278
+ ],
1279
+ permissionIds: [
1280
+ 'string'
1281
+ ],
1282
+ permissions: [
1283
+ {
1284
+ allowFileDiscovery: false,
1285
+ deleted: true,
1286
+ displayName: 'string',
1287
+ domain: 'string',
1288
+ emailAddress: 'string',
1289
+ expirationTime: 'string',
1290
+ id: 'string',
1291
+ kind: 'drive#permission',
1292
+ pendingOwner: true,
1293
+ permissionDetails: [
1294
+ {
1295
+ inherited: false,
1296
+ inheritedFrom: 'string',
1297
+ permissionType: 'string',
1298
+ role: 'string'
1299
+ }
1300
+ ],
1301
+ photoLink: 'string',
1302
+ role: 'string',
1303
+ teamDrivePermissionDetails: [
1304
+ {
1305
+ inherited: true,
1306
+ inheritedFrom: 'string',
1307
+ role: 'string',
1308
+ teamDrivePermissionType: 'string'
1309
+ }
1310
+ ],
1311
+ type: 'string',
1312
+ view: 'string'
1313
+ }
1314
+ ],
1315
+ properties: {},
1316
+ quotaBytesUsed: 'string',
1317
+ resourceKey: 'string',
1318
+ shared: false,
1319
+ sharedWithMeTime: 'string',
1320
+ sharingUser: {
1321
+ displayName: 'string',
1322
+ emailAddress: 'string',
1323
+ kind: 'drive#user',
1324
+ me: true,
1325
+ permissionId: 'string',
1326
+ photoLink: 'string'
1327
+ },
1328
+ shortcutDetails: {
1329
+ targetId: 'string',
1330
+ targetMimeType: 'string',
1331
+ targetResourceKey: 'string'
1332
+ },
1333
+ size: 'string',
1334
+ spaces: [
1335
+ 'string'
1336
+ ],
1337
+ starred: false,
1338
+ teamDriveId: 'string',
1339
+ thumbnailLink: 'string',
1340
+ thumbnailVersion: 'string',
1341
+ trashed: false,
1342
+ trashedTime: 'string',
1343
+ trashingUser: {
1344
+ displayName: 'string',
1345
+ emailAddress: 'string',
1346
+ kind: 'drive#user',
1347
+ me: false,
1348
+ permissionId: 'string',
1349
+ photoLink: 'string'
1350
+ },
1351
+ version: 'string',
1352
+ videoMediaMetadata: {
1353
+ durationMillis: 'string',
1354
+ height: 5,
1355
+ width: 8
1356
+ },
1357
+ viewedByMe: true,
1358
+ viewedByMeTime: 'string',
1359
+ viewersCanCopyContent: false,
1360
+ webContentLink: 'string',
1361
+ webViewLink: 'string',
1362
+ writersCanShare: true
1363
+ };
1364
+ describe('#driveFilesCopy - errors', () => {
1365
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1366
+ if (pronghorn.methodsByName.driveFilesCopy.task) {
1367
+ try {
1368
+ a.driveFilesCopy(null, null, null, null, null, null, null, filesFileId, null, null, null, null, null, null, null, filesDriveFilesCopyBodyParam, (data, error) => {
1369
+ try {
1370
+ if (stub) {
1371
+ const displayE = 'Error 400 received on request';
1372
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1373
+ } else {
1374
+ runCommonAsserts(data, error);
1375
+ }
1376
+ saveMockData('Files', 'driveFilesCopy', 'default', data);
1377
+ done();
1378
+ } catch (err) {
1379
+ log.error(`Test Failure: ${err}`);
1380
+ done(err);
1381
+ }
1382
+ });
1383
+ } catch (error) {
1384
+ log.error(`Adapter Exception: ${error}`);
1385
+ done(error);
1386
+ }
1387
+ } else {
1388
+ log.error('driveFilesCopy task is false, skipping test');
1389
+ skipCount += 1;
1390
+ done();
1391
+ }// end if task
1392
+ }).timeout(attemptTimeout);
1393
+ });
1394
+
1395
+ const filesDriveFilesWatchBodyParam = {
1396
+ address: 'string',
1397
+ expiration: 'string',
1398
+ id: 'string',
1399
+ kind: 'api#channel',
1400
+ params: {},
1401
+ payload: false,
1402
+ resourceId: 'string',
1403
+ resourceUri: 'string',
1404
+ token: 'string',
1405
+ type: 'string'
1406
+ };
1407
+ describe('#driveFilesWatch - errors', () => {
1408
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1409
+ if (pronghorn.methodsByName.driveFilesWatch.task) {
1410
+ try {
1411
+ a.driveFilesWatch(null, null, null, null, null, null, null, filesFileId, null, null, null, null, filesDriveFilesWatchBodyParam, (data, error) => {
1412
+ try {
1413
+ if (stub) {
1414
+ const displayE = 'Error 400 received on request';
1415
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1416
+ } else {
1417
+ runCommonAsserts(data, error);
1418
+ }
1419
+ saveMockData('Files', 'driveFilesWatch', 'default', data);
1420
+ done();
1421
+ } catch (err) {
1422
+ log.error(`Test Failure: ${err}`);
1423
+ done(err);
1424
+ }
1425
+ });
1426
+ } catch (error) {
1427
+ log.error(`Adapter Exception: ${error}`);
1428
+ done(error);
1429
+ }
1430
+ } else {
1431
+ log.error('driveFilesWatch task is false, skipping test');
1432
+ skipCount += 1;
1433
+ done();
1434
+ }// end if task
1435
+ }).timeout(attemptTimeout);
1436
+ });
1437
+
1438
+ describe('#driveFilesList - errors', () => {
1439
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1440
+ if (pronghorn.methodsByName.driveFilesList.task) {
1441
+ try {
1442
+ a.driveFilesList(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
1443
+ try {
1444
+ if (stub) {
1445
+ const displayE = 'Error 400 received on request';
1446
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1447
+ } else {
1448
+ runCommonAsserts(data, error);
1449
+ }
1450
+ saveMockData('Files', 'driveFilesList', 'default', data);
1451
+ done();
1452
+ } catch (err) {
1453
+ log.error(`Test Failure: ${err}`);
1454
+ done(err);
1455
+ }
1456
+ });
1457
+ } catch (error) {
1458
+ log.error(`Adapter Exception: ${error}`);
1459
+ done(error);
1460
+ }
1461
+ } else {
1462
+ log.error('driveFilesList task is false, skipping test');
1463
+ skipCount += 1;
1464
+ done();
1465
+ }// end if task
1466
+ }).timeout(attemptTimeout);
1467
+ });
1468
+
1469
+ describe('#driveFilesGenerateIds - errors', () => {
1470
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1471
+ if (pronghorn.methodsByName.driveFilesGenerateIds.task) {
1472
+ try {
1473
+ a.driveFilesGenerateIds(null, null, null, null, null, null, null, null, null, null, (data, error) => {
1474
+ try {
1475
+ if (stub) {
1476
+ const displayE = 'Error 400 received on request';
1477
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1478
+ } else {
1479
+ runCommonAsserts(data, error);
1480
+ }
1481
+ saveMockData('Files', 'driveFilesGenerateIds', 'default', data);
1482
+ done();
1483
+ } catch (err) {
1484
+ log.error(`Test Failure: ${err}`);
1485
+ done(err);
1486
+ }
1487
+ });
1488
+ } catch (error) {
1489
+ log.error(`Adapter Exception: ${error}`);
1490
+ done(error);
1491
+ }
1492
+ } else {
1493
+ log.error('driveFilesGenerateIds task is false, skipping test');
1494
+ skipCount += 1;
1495
+ done();
1496
+ }// end if task
1497
+ }).timeout(attemptTimeout);
1498
+ });
1499
+
1500
+ const filesDriveFilesUpdateBodyParam = {
1501
+ appProperties: {},
1502
+ capabilities: {
1503
+ canAcceptOwnership: true,
1504
+ canAddChildren: false,
1505
+ canAddFolderFromAnotherDrive: false,
1506
+ canAddMyDriveParent: true,
1507
+ canChangeCopyRequiresWriterPermission: true,
1508
+ canChangeSecurityUpdateEnabled: true,
1509
+ canChangeViewersCanCopyContent: false,
1510
+ canComment: false,
1511
+ canCopy: true,
1512
+ canDelete: false,
1513
+ canDeleteChildren: false,
1514
+ canDownload: false,
1515
+ canEdit: true,
1516
+ canListChildren: true,
1517
+ canModifyContent: false,
1518
+ canModifyContentRestriction: true,
1519
+ canMoveChildrenOutOfDrive: true,
1520
+ canMoveChildrenOutOfTeamDrive: false,
1521
+ canMoveChildrenWithinDrive: true,
1522
+ canMoveChildrenWithinTeamDrive: false,
1523
+ canMoveItemIntoTeamDrive: true,
1524
+ canMoveItemOutOfDrive: false,
1525
+ canMoveItemOutOfTeamDrive: false,
1526
+ canMoveItemWithinDrive: true,
1527
+ canMoveItemWithinTeamDrive: false,
1528
+ canMoveTeamDriveItem: false,
1529
+ canReadDrive: false,
1530
+ canReadRevisions: true,
1531
+ canReadTeamDrive: true,
1532
+ canRemoveChildren: true,
1533
+ canRemoveMyDriveParent: true,
1534
+ canRename: false,
1535
+ canShare: true,
1536
+ canTrash: false,
1537
+ canTrashChildren: false,
1538
+ canUntrash: false
1539
+ },
1540
+ contentHints: {
1541
+ indexableText: 'string',
1542
+ thumbnail: {
1543
+ image: 'string',
1544
+ mimeType: 'string'
1545
+ }
1546
+ },
1547
+ contentRestrictions: [
1548
+ {
1549
+ readOnly: true,
1550
+ reason: 'string',
1551
+ restrictingUser: {
1552
+ displayName: 'string',
1553
+ emailAddress: 'string',
1554
+ kind: 'drive#user',
1555
+ me: false,
1556
+ permissionId: 'string',
1557
+ photoLink: 'string'
1558
+ },
1559
+ restrictionTime: 'string',
1560
+ type: 'string'
1561
+ }
1562
+ ],
1563
+ copyRequiresWriterPermission: false,
1564
+ createdTime: 'string',
1565
+ description: 'string',
1566
+ driveId: 'string',
1567
+ explicitlyTrashed: false,
1568
+ exportLinks: {},
1569
+ fileExtension: 'string',
1570
+ folderColorRgb: 'string',
1571
+ fullFileExtension: 'string',
1572
+ hasAugmentedPermissions: true,
1573
+ hasThumbnail: false,
1574
+ headRevisionId: 'string',
1575
+ iconLink: 'string',
1576
+ id: 'string',
1577
+ imageMediaMetadata: {
1578
+ aperture: 3,
1579
+ cameraMake: 'string',
1580
+ cameraModel: 'string',
1581
+ colorSpace: 'string',
1582
+ exposureBias: 10,
1583
+ exposureMode: 'string',
1584
+ exposureTime: 2,
1585
+ flashUsed: true,
1586
+ focalLength: 6,
1587
+ height: 1,
1588
+ isoSpeed: 1,
1589
+ lens: 'string',
1590
+ location: {
1591
+ altitude: 2,
1592
+ latitude: 5,
1593
+ longitude: 9
1594
+ },
1595
+ maxApertureValue: 8,
1596
+ meteringMode: 'string',
1597
+ rotation: 4,
1598
+ sensor: 'string',
1599
+ subjectDistance: 4,
1600
+ time: 'string',
1601
+ whiteBalance: 'string',
1602
+ width: 1
1603
+ },
1604
+ isAppAuthorized: true,
1605
+ kind: 'drive#file',
1606
+ lastModifyingUser: {
1607
+ displayName: 'string',
1608
+ emailAddress: 'string',
1609
+ kind: 'drive#user',
1610
+ me: true,
1611
+ permissionId: 'string',
1612
+ photoLink: 'string'
1613
+ },
1614
+ linkShareMetadata: {
1615
+ securityUpdateEligible: false,
1616
+ securityUpdateEnabled: true
1617
+ },
1618
+ md5Checksum: 'string',
1619
+ mimeType: 'string',
1620
+ modifiedByMe: false,
1621
+ modifiedByMeTime: 'string',
1622
+ modifiedTime: 'string',
1623
+ name: 'string',
1624
+ originalFilename: 'string',
1625
+ ownedByMe: false,
1626
+ owners: [
1627
+ {
1628
+ displayName: 'string',
1629
+ emailAddress: 'string',
1630
+ kind: 'drive#user',
1631
+ me: true,
1632
+ permissionId: 'string',
1633
+ photoLink: 'string'
1634
+ }
1635
+ ],
1636
+ parents: [
1637
+ 'string'
1638
+ ],
1639
+ permissionIds: [
1640
+ 'string'
1641
+ ],
1642
+ permissions: [
1643
+ {
1644
+ allowFileDiscovery: true,
1645
+ deleted: false,
1646
+ displayName: 'string',
1647
+ domain: 'string',
1648
+ emailAddress: 'string',
1649
+ expirationTime: 'string',
1650
+ id: 'string',
1651
+ kind: 'drive#permission',
1652
+ pendingOwner: true,
1653
+ permissionDetails: [
1654
+ {
1655
+ inherited: true,
1656
+ inheritedFrom: 'string',
1657
+ permissionType: 'string',
1658
+ role: 'string'
1659
+ }
1660
+ ],
1661
+ photoLink: 'string',
1662
+ role: 'string',
1663
+ teamDrivePermissionDetails: [
1664
+ {
1665
+ inherited: true,
1666
+ inheritedFrom: 'string',
1667
+ role: 'string',
1668
+ teamDrivePermissionType: 'string'
1669
+ }
1670
+ ],
1671
+ type: 'string',
1672
+ view: 'string'
1673
+ }
1674
+ ],
1675
+ properties: {},
1676
+ quotaBytesUsed: 'string',
1677
+ resourceKey: 'string',
1678
+ shared: false,
1679
+ sharedWithMeTime: 'string',
1680
+ sharingUser: {
1681
+ displayName: 'string',
1682
+ emailAddress: 'string',
1683
+ kind: 'drive#user',
1684
+ me: false,
1685
+ permissionId: 'string',
1686
+ photoLink: 'string'
1687
+ },
1688
+ shortcutDetails: {
1689
+ targetId: 'string',
1690
+ targetMimeType: 'string',
1691
+ targetResourceKey: 'string'
1692
+ },
1693
+ size: 'string',
1694
+ spaces: [
1695
+ 'string'
1696
+ ],
1697
+ starred: false,
1698
+ teamDriveId: 'string',
1699
+ thumbnailLink: 'string',
1700
+ thumbnailVersion: 'string',
1701
+ trashed: false,
1702
+ trashedTime: 'string',
1703
+ trashingUser: {
1704
+ displayName: 'string',
1705
+ emailAddress: 'string',
1706
+ kind: 'drive#user',
1707
+ me: false,
1708
+ permissionId: 'string',
1709
+ photoLink: 'string'
1710
+ },
1711
+ version: 'string',
1712
+ videoMediaMetadata: {
1713
+ durationMillis: 'string',
1714
+ height: 4,
1715
+ width: 7
1716
+ },
1717
+ viewedByMe: true,
1718
+ viewedByMeTime: 'string',
1719
+ viewersCanCopyContent: false,
1720
+ webContentLink: 'string',
1721
+ webViewLink: 'string',
1722
+ writersCanShare: false
1723
+ };
1724
+ describe('#driveFilesUpdate - errors', () => {
1725
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1726
+ if (pronghorn.methodsByName.driveFilesUpdate.task) {
1727
+ try {
1728
+ a.driveFilesUpdate(null, null, null, null, null, null, null, filesFileId, null, null, null, null, null, null, null, null, null, filesDriveFilesUpdateBodyParam, (data, error) => {
1729
+ try {
1730
+ if (stub) {
1731
+ const displayE = 'Error 400 received on request';
1732
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1733
+ } else {
1734
+ runCommonAsserts(data, error);
1735
+ }
1736
+ saveMockData('Files', 'driveFilesUpdate', 'default', data);
1737
+ done();
1738
+ } catch (err) {
1739
+ log.error(`Test Failure: ${err}`);
1740
+ done(err);
1741
+ }
1742
+ });
1743
+ } catch (error) {
1744
+ log.error(`Adapter Exception: ${error}`);
1745
+ done(error);
1746
+ }
1747
+ } else {
1748
+ log.error('driveFilesUpdate task is false, skipping test');
1749
+ skipCount += 1;
1750
+ done();
1751
+ }// end if task
1752
+ }).timeout(attemptTimeout);
1753
+ });
1754
+
1755
+ describe('#driveFilesGet - errors', () => {
1756
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1757
+ if (pronghorn.methodsByName.driveFilesGet.task) {
1758
+ try {
1759
+ a.driveFilesGet(null, null, null, null, null, null, null, filesFileId, null, null, null, null, (data, error) => {
1760
+ try {
1761
+ if (stub) {
1762
+ const displayE = 'Error 400 received on request';
1763
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1764
+ } else {
1765
+ runCommonAsserts(data, error);
1766
+ }
1767
+ saveMockData('Files', 'driveFilesGet', 'default', data);
1768
+ done();
1769
+ } catch (err) {
1770
+ log.error(`Test Failure: ${err}`);
1771
+ done(err);
1772
+ }
1773
+ });
1774
+ } catch (error) {
1775
+ log.error(`Adapter Exception: ${error}`);
1776
+ done(error);
1777
+ }
1778
+ } else {
1779
+ log.error('driveFilesGet task is false, skipping test');
1780
+ skipCount += 1;
1781
+ done();
1782
+ }// end if task
1783
+ }).timeout(attemptTimeout);
1784
+ });
1785
+
1786
+ const filesMimeType = 'fakedata';
1787
+ describe('#driveFilesExport - errors', () => {
1788
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1789
+ if (pronghorn.methodsByName.driveFilesExport.task) {
1790
+ try {
1791
+ a.driveFilesExport(null, null, null, null, null, null, null, filesFileId, filesMimeType, (data, error) => {
1792
+ try {
1793
+ if (stub) {
1794
+ const displayE = 'Error 400 received on request';
1795
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1796
+ } else {
1797
+ runCommonAsserts(data, error);
1798
+ }
1799
+ saveMockData('Files', 'driveFilesExport', 'default', data);
1800
+ done();
1801
+ } catch (err) {
1802
+ log.error(`Test Failure: ${err}`);
1803
+ done(err);
1804
+ }
1805
+ });
1806
+ } catch (error) {
1807
+ log.error(`Adapter Exception: ${error}`);
1808
+ done(error);
1809
+ }
1810
+ } else {
1811
+ log.error('driveFilesExport task is false, skipping test');
1812
+ skipCount += 1;
1813
+ done();
1814
+ }// end if task
1815
+ }).timeout(attemptTimeout);
1816
+ });
1817
+
1818
+ const commentsFileId = 'fakedata';
1819
+ const commentsDriveCommentsCreateBodyParam = {
1820
+ anchor: 'string',
1821
+ author: {
1822
+ displayName: 'string',
1823
+ emailAddress: 'string',
1824
+ kind: 'drive#user',
1825
+ me: false,
1826
+ permissionId: 'string',
1827
+ photoLink: 'string'
1828
+ },
1829
+ content: 'string',
1830
+ createdTime: 'string',
1831
+ deleted: true,
1832
+ htmlContent: 'string',
1833
+ id: 'string',
1834
+ kind: 'drive#comment',
1835
+ modifiedTime: 'string',
1836
+ quotedFileContent: {
1837
+ mimeType: 'string',
1838
+ value: 'string'
1839
+ },
1840
+ replies: [
1841
+ {
1842
+ action: 'string',
1843
+ author: {
1844
+ displayName: 'string',
1845
+ emailAddress: 'string',
1846
+ kind: 'drive#user',
1847
+ me: false,
1848
+ permissionId: 'string',
1849
+ photoLink: 'string'
1850
+ },
1851
+ content: 'string',
1852
+ createdTime: 'string',
1853
+ deleted: true,
1854
+ htmlContent: 'string',
1855
+ id: 'string',
1856
+ kind: 'drive#reply',
1857
+ modifiedTime: 'string'
1858
+ }
1859
+ ],
1860
+ resolved: true
1861
+ };
1862
+ describe('#driveCommentsCreate - errors', () => {
1863
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1864
+ if (pronghorn.methodsByName.driveCommentsCreate.task) {
1865
+ try {
1866
+ a.driveCommentsCreate(null, null, null, null, null, null, null, commentsFileId, commentsDriveCommentsCreateBodyParam, (data, error) => {
1867
+ try {
1868
+ if (stub) {
1869
+ const displayE = 'Error 400 received on request';
1870
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1871
+ } else {
1872
+ runCommonAsserts(data, error);
1873
+ }
1874
+ saveMockData('Comments', 'driveCommentsCreate', 'default', data);
1875
+ done();
1876
+ } catch (err) {
1877
+ log.error(`Test Failure: ${err}`);
1878
+ done(err);
1879
+ }
1880
+ });
1881
+ } catch (error) {
1882
+ log.error(`Adapter Exception: ${error}`);
1883
+ done(error);
1884
+ }
1885
+ } else {
1886
+ log.error('driveCommentsCreate task is false, skipping test');
1887
+ skipCount += 1;
1888
+ done();
1889
+ }// end if task
1890
+ }).timeout(attemptTimeout);
1891
+ });
1892
+
1893
+ describe('#driveCommentsList - errors', () => {
1894
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1895
+ if (pronghorn.methodsByName.driveCommentsList.task) {
1896
+ try {
1897
+ a.driveCommentsList(null, null, null, null, null, null, null, commentsFileId, null, null, null, null, (data, error) => {
1898
+ try {
1899
+ if (stub) {
1900
+ const displayE = 'Error 400 received on request';
1901
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1902
+ } else {
1903
+ runCommonAsserts(data, error);
1904
+ }
1905
+ saveMockData('Comments', 'driveCommentsList', 'default', data);
1906
+ done();
1907
+ } catch (err) {
1908
+ log.error(`Test Failure: ${err}`);
1909
+ done(err);
1910
+ }
1911
+ });
1912
+ } catch (error) {
1913
+ log.error(`Adapter Exception: ${error}`);
1914
+ done(error);
1915
+ }
1916
+ } else {
1917
+ log.error('driveCommentsList task is false, skipping test');
1918
+ skipCount += 1;
1919
+ done();
1920
+ }// end if task
1921
+ }).timeout(attemptTimeout);
1922
+ });
1923
+
1924
+ const commentsCommentId = 'fakedata';
1925
+ const commentsDriveCommentsUpdateBodyParam = {
1926
+ anchor: 'string',
1927
+ author: {
1928
+ displayName: 'string',
1929
+ emailAddress: 'string',
1930
+ kind: 'drive#user',
1931
+ me: false,
1932
+ permissionId: 'string',
1933
+ photoLink: 'string'
1934
+ },
1935
+ content: 'string',
1936
+ createdTime: 'string',
1937
+ deleted: true,
1938
+ htmlContent: 'string',
1939
+ id: 'string',
1940
+ kind: 'drive#comment',
1941
+ modifiedTime: 'string',
1942
+ quotedFileContent: {
1943
+ mimeType: 'string',
1944
+ value: 'string'
1945
+ },
1946
+ replies: [
1947
+ {
1948
+ action: 'string',
1949
+ author: {
1950
+ displayName: 'string',
1951
+ emailAddress: 'string',
1952
+ kind: 'drive#user',
1953
+ me: true,
1954
+ permissionId: 'string',
1955
+ photoLink: 'string'
1956
+ },
1957
+ content: 'string',
1958
+ createdTime: 'string',
1959
+ deleted: true,
1960
+ htmlContent: 'string',
1961
+ id: 'string',
1962
+ kind: 'drive#reply',
1963
+ modifiedTime: 'string'
1964
+ }
1965
+ ],
1966
+ resolved: true
1967
+ };
1968
+ describe('#driveCommentsUpdate - errors', () => {
1969
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1970
+ if (pronghorn.methodsByName.driveCommentsUpdate.task) {
1971
+ try {
1972
+ a.driveCommentsUpdate(null, null, null, null, null, null, null, commentsFileId, commentsCommentId, commentsDriveCommentsUpdateBodyParam, (data, error) => {
1973
+ try {
1974
+ if (stub) {
1975
+ const displayE = 'Error 400 received on request';
1976
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
1977
+ } else {
1978
+ runCommonAsserts(data, error);
1979
+ }
1980
+ saveMockData('Comments', 'driveCommentsUpdate', 'default', data);
1981
+ done();
1982
+ } catch (err) {
1983
+ log.error(`Test Failure: ${err}`);
1984
+ done(err);
1985
+ }
1986
+ });
1987
+ } catch (error) {
1988
+ log.error(`Adapter Exception: ${error}`);
1989
+ done(error);
1990
+ }
1991
+ } else {
1992
+ log.error('driveCommentsUpdate task is false, skipping test');
1993
+ skipCount += 1;
1994
+ done();
1995
+ }// end if task
1996
+ }).timeout(attemptTimeout);
1997
+ });
1998
+
1999
+ describe('#driveCommentsGet - errors', () => {
2000
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2001
+ if (pronghorn.methodsByName.driveCommentsGet.task) {
2002
+ try {
2003
+ a.driveCommentsGet(null, null, null, null, null, null, null, commentsFileId, commentsCommentId, null, (data, error) => {
2004
+ try {
2005
+ if (stub) {
2006
+ const displayE = 'Error 400 received on request';
2007
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2008
+ } else {
2009
+ runCommonAsserts(data, error);
2010
+ }
2011
+ saveMockData('Comments', 'driveCommentsGet', 'default', data);
2012
+ done();
2013
+ } catch (err) {
2014
+ log.error(`Test Failure: ${err}`);
2015
+ done(err);
2016
+ }
2017
+ });
2018
+ } catch (error) {
2019
+ log.error(`Adapter Exception: ${error}`);
2020
+ done(error);
2021
+ }
2022
+ } else {
2023
+ log.error('driveCommentsGet task is false, skipping test');
2024
+ skipCount += 1;
2025
+ done();
2026
+ }// end if task
2027
+ }).timeout(attemptTimeout);
2028
+ });
2029
+
2030
+ const repliesFileId = 'fakedata';
2031
+ const repliesCommentId = 'fakedata';
2032
+ const repliesDriveRepliesCreateBodyParam = {
2033
+ action: 'string',
2034
+ author: {
2035
+ displayName: 'string',
2036
+ emailAddress: 'string',
2037
+ kind: 'drive#user',
2038
+ me: false,
2039
+ permissionId: 'string',
2040
+ photoLink: 'string'
2041
+ },
2042
+ content: 'string',
2043
+ createdTime: 'string',
2044
+ deleted: true,
2045
+ htmlContent: 'string',
2046
+ id: 'string',
2047
+ kind: 'drive#reply',
2048
+ modifiedTime: 'string'
2049
+ };
2050
+ describe('#driveRepliesCreate - errors', () => {
2051
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2052
+ if (pronghorn.methodsByName.driveRepliesCreate.task) {
2053
+ try {
2054
+ a.driveRepliesCreate(null, null, null, null, null, null, null, repliesFileId, repliesCommentId, repliesDriveRepliesCreateBodyParam, (data, error) => {
2055
+ try {
2056
+ if (stub) {
2057
+ const displayE = 'Error 400 received on request';
2058
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2059
+ } else {
2060
+ runCommonAsserts(data, error);
2061
+ }
2062
+ saveMockData('Replies', 'driveRepliesCreate', 'default', data);
2063
+ done();
2064
+ } catch (err) {
2065
+ log.error(`Test Failure: ${err}`);
2066
+ done(err);
2067
+ }
2068
+ });
2069
+ } catch (error) {
2070
+ log.error(`Adapter Exception: ${error}`);
2071
+ done(error);
2072
+ }
2073
+ } else {
2074
+ log.error('driveRepliesCreate task is false, skipping test');
2075
+ skipCount += 1;
2076
+ done();
2077
+ }// end if task
2078
+ }).timeout(attemptTimeout);
2079
+ });
2080
+
2081
+ describe('#driveRepliesList - errors', () => {
2082
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2083
+ if (pronghorn.methodsByName.driveRepliesList.task) {
2084
+ try {
2085
+ a.driveRepliesList(null, null, null, null, null, null, null, repliesFileId, repliesCommentId, null, null, null, (data, error) => {
2086
+ try {
2087
+ if (stub) {
2088
+ const displayE = 'Error 400 received on request';
2089
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2090
+ } else {
2091
+ runCommonAsserts(data, error);
2092
+ }
2093
+ saveMockData('Replies', 'driveRepliesList', 'default', data);
2094
+ done();
2095
+ } catch (err) {
2096
+ log.error(`Test Failure: ${err}`);
2097
+ done(err);
2098
+ }
2099
+ });
2100
+ } catch (error) {
2101
+ log.error(`Adapter Exception: ${error}`);
2102
+ done(error);
2103
+ }
2104
+ } else {
2105
+ log.error('driveRepliesList task is false, skipping test');
2106
+ skipCount += 1;
2107
+ done();
2108
+ }// end if task
2109
+ }).timeout(attemptTimeout);
2110
+ });
2111
+
2112
+ const repliesReplyId = 'fakedata';
2113
+ const repliesDriveRepliesUpdateBodyParam = {
2114
+ action: 'string',
2115
+ author: {
2116
+ displayName: 'string',
2117
+ emailAddress: 'string',
2118
+ kind: 'drive#user',
2119
+ me: false,
2120
+ permissionId: 'string',
2121
+ photoLink: 'string'
2122
+ },
2123
+ content: 'string',
2124
+ createdTime: 'string',
2125
+ deleted: true,
2126
+ htmlContent: 'string',
2127
+ id: 'string',
2128
+ kind: 'drive#reply',
2129
+ modifiedTime: 'string'
2130
+ };
2131
+ describe('#driveRepliesUpdate - errors', () => {
2132
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2133
+ if (pronghorn.methodsByName.driveRepliesUpdate.task) {
2134
+ try {
2135
+ a.driveRepliesUpdate(null, null, null, null, null, null, null, repliesFileId, repliesCommentId, repliesReplyId, repliesDriveRepliesUpdateBodyParam, (data, error) => {
2136
+ try {
2137
+ if (stub) {
2138
+ const displayE = 'Error 400 received on request';
2139
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2140
+ } else {
2141
+ runCommonAsserts(data, error);
2142
+ }
2143
+ saveMockData('Replies', 'driveRepliesUpdate', 'default', data);
2144
+ done();
2145
+ } catch (err) {
2146
+ log.error(`Test Failure: ${err}`);
2147
+ done(err);
2148
+ }
2149
+ });
2150
+ } catch (error) {
2151
+ log.error(`Adapter Exception: ${error}`);
2152
+ done(error);
2153
+ }
2154
+ } else {
2155
+ log.error('driveRepliesUpdate task is false, skipping test');
2156
+ skipCount += 1;
2157
+ done();
2158
+ }// end if task
2159
+ }).timeout(attemptTimeout);
2160
+ });
2161
+
2162
+ describe('#driveRepliesGet - errors', () => {
2163
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2164
+ if (pronghorn.methodsByName.driveRepliesGet.task) {
2165
+ try {
2166
+ a.driveRepliesGet(null, null, null, null, null, null, null, repliesFileId, repliesCommentId, repliesReplyId, null, (data, error) => {
2167
+ try {
2168
+ if (stub) {
2169
+ const displayE = 'Error 400 received on request';
2170
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2171
+ } else {
2172
+ runCommonAsserts(data, error);
2173
+ }
2174
+ saveMockData('Replies', 'driveRepliesGet', 'default', data);
2175
+ done();
2176
+ } catch (err) {
2177
+ log.error(`Test Failure: ${err}`);
2178
+ done(err);
2179
+ }
2180
+ });
2181
+ } catch (error) {
2182
+ log.error(`Adapter Exception: ${error}`);
2183
+ done(error);
2184
+ }
2185
+ } else {
2186
+ log.error('driveRepliesGet task is false, skipping test');
2187
+ skipCount += 1;
2188
+ done();
2189
+ }// end if task
2190
+ }).timeout(attemptTimeout);
2191
+ });
2192
+
2193
+ const permissionsFileId = 'fakedata';
2194
+ const permissionsDrivePermissionsCreateBodyParam = {
2195
+ allowFileDiscovery: true,
2196
+ deleted: true,
2197
+ displayName: 'string',
2198
+ domain: 'string',
2199
+ emailAddress: 'string',
2200
+ expirationTime: 'string',
2201
+ id: 'string',
2202
+ kind: 'drive#permission',
2203
+ pendingOwner: true,
2204
+ permissionDetails: [
2205
+ {
2206
+ inherited: true,
2207
+ inheritedFrom: 'string',
2208
+ permissionType: 'string',
2209
+ role: 'string'
2210
+ }
2211
+ ],
2212
+ photoLink: 'string',
2213
+ role: 'string',
2214
+ teamDrivePermissionDetails: [
2215
+ {
2216
+ inherited: false,
2217
+ inheritedFrom: 'string',
2218
+ role: 'string',
2219
+ teamDrivePermissionType: 'string'
2220
+ }
2221
+ ],
2222
+ type: 'string',
2223
+ view: 'string'
2224
+ };
2225
+ describe('#drivePermissionsCreate - errors', () => {
2226
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2227
+ if (pronghorn.methodsByName.drivePermissionsCreate.task) {
2228
+ try {
2229
+ a.drivePermissionsCreate(null, null, null, null, null, null, null, permissionsFileId, null, null, null, null, null, null, null, null, permissionsDrivePermissionsCreateBodyParam, (data, error) => {
2230
+ try {
2231
+ if (stub) {
2232
+ const displayE = 'Error 400 received on request';
2233
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2234
+ } else {
2235
+ runCommonAsserts(data, error);
2236
+ }
2237
+ saveMockData('Permissions', 'drivePermissionsCreate', 'default', data);
2238
+ done();
2239
+ } catch (err) {
2240
+ log.error(`Test Failure: ${err}`);
2241
+ done(err);
2242
+ }
2243
+ });
2244
+ } catch (error) {
2245
+ log.error(`Adapter Exception: ${error}`);
2246
+ done(error);
2247
+ }
2248
+ } else {
2249
+ log.error('drivePermissionsCreate task is false, skipping test');
2250
+ skipCount += 1;
2251
+ done();
2252
+ }// end if task
2253
+ }).timeout(attemptTimeout);
2254
+ });
2255
+
2256
+ describe('#drivePermissionsList - errors', () => {
2257
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2258
+ if (pronghorn.methodsByName.drivePermissionsList.task) {
2259
+ try {
2260
+ a.drivePermissionsList(null, null, null, null, null, null, null, permissionsFileId, null, null, null, null, null, null, (data, error) => {
2261
+ try {
2262
+ if (stub) {
2263
+ const displayE = 'Error 400 received on request';
2264
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2265
+ } else {
2266
+ runCommonAsserts(data, error);
2267
+ }
2268
+ saveMockData('Permissions', 'drivePermissionsList', 'default', data);
2269
+ done();
2270
+ } catch (err) {
2271
+ log.error(`Test Failure: ${err}`);
2272
+ done(err);
2273
+ }
2274
+ });
2275
+ } catch (error) {
2276
+ log.error(`Adapter Exception: ${error}`);
2277
+ done(error);
2278
+ }
2279
+ } else {
2280
+ log.error('drivePermissionsList task is false, skipping test');
2281
+ skipCount += 1;
2282
+ done();
2283
+ }// end if task
2284
+ }).timeout(attemptTimeout);
2285
+ });
2286
+
2287
+ const permissionsPermissionId = 'fakedata';
2288
+ const permissionsDrivePermissionsUpdateBodyParam = {
2289
+ allowFileDiscovery: true,
2290
+ deleted: false,
2291
+ displayName: 'string',
2292
+ domain: 'string',
2293
+ emailAddress: 'string',
2294
+ expirationTime: 'string',
2295
+ id: 'string',
2296
+ kind: 'drive#permission',
2297
+ pendingOwner: false,
2298
+ permissionDetails: [
2299
+ {
2300
+ inherited: false,
2301
+ inheritedFrom: 'string',
2302
+ permissionType: 'string',
2303
+ role: 'string'
2304
+ }
2305
+ ],
2306
+ photoLink: 'string',
2307
+ role: 'string',
2308
+ teamDrivePermissionDetails: [
2309
+ {
2310
+ inherited: false,
2311
+ inheritedFrom: 'string',
2312
+ role: 'string',
2313
+ teamDrivePermissionType: 'string'
2314
+ }
2315
+ ],
2316
+ type: 'string',
2317
+ view: 'string'
2318
+ };
2319
+ describe('#drivePermissionsUpdate - errors', () => {
2320
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2321
+ if (pronghorn.methodsByName.drivePermissionsUpdate.task) {
2322
+ try {
2323
+ a.drivePermissionsUpdate(null, null, null, null, null, null, null, permissionsFileId, permissionsPermissionId, null, null, null, null, null, permissionsDrivePermissionsUpdateBodyParam, (data, error) => {
2324
+ try {
2325
+ if (stub) {
2326
+ const displayE = 'Error 400 received on request';
2327
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2328
+ } else {
2329
+ runCommonAsserts(data, error);
2330
+ }
2331
+ saveMockData('Permissions', 'drivePermissionsUpdate', 'default', data);
2332
+ done();
2333
+ } catch (err) {
2334
+ log.error(`Test Failure: ${err}`);
2335
+ done(err);
2336
+ }
2337
+ });
2338
+ } catch (error) {
2339
+ log.error(`Adapter Exception: ${error}`);
2340
+ done(error);
2341
+ }
2342
+ } else {
2343
+ log.error('drivePermissionsUpdate task is false, skipping test');
2344
+ skipCount += 1;
2345
+ done();
2346
+ }// end if task
2347
+ }).timeout(attemptTimeout);
2348
+ });
2349
+
2350
+ describe('#drivePermissionsGet - errors', () => {
2351
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2352
+ if (pronghorn.methodsByName.drivePermissionsGet.task) {
2353
+ try {
2354
+ a.drivePermissionsGet(null, null, null, null, null, null, null, permissionsFileId, permissionsPermissionId, null, null, null, (data, error) => {
2355
+ try {
2356
+ if (stub) {
2357
+ const displayE = 'Error 400 received on request';
2358
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2359
+ } else {
2360
+ runCommonAsserts(data, error);
2361
+ }
2362
+ saveMockData('Permissions', 'drivePermissionsGet', 'default', data);
2363
+ done();
2364
+ } catch (err) {
2365
+ log.error(`Test Failure: ${err}`);
2366
+ done(err);
2367
+ }
2368
+ });
2369
+ } catch (error) {
2370
+ log.error(`Adapter Exception: ${error}`);
2371
+ done(error);
2372
+ }
2373
+ } else {
2374
+ log.error('drivePermissionsGet task is false, skipping test');
2375
+ skipCount += 1;
2376
+ done();
2377
+ }// end if task
2378
+ }).timeout(attemptTimeout);
2379
+ });
2380
+
2381
+ const revisionsFileId = 'fakedata';
2382
+ describe('#driveRevisionsList - errors', () => {
2383
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2384
+ if (pronghorn.methodsByName.driveRevisionsList.task) {
2385
+ try {
2386
+ a.driveRevisionsList(null, null, null, null, null, null, null, revisionsFileId, null, null, (data, error) => {
2387
+ try {
2388
+ if (stub) {
2389
+ const displayE = 'Error 400 received on request';
2390
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2391
+ } else {
2392
+ runCommonAsserts(data, error);
2393
+ }
2394
+ saveMockData('Revisions', 'driveRevisionsList', 'default', data);
2395
+ done();
2396
+ } catch (err) {
2397
+ log.error(`Test Failure: ${err}`);
2398
+ done(err);
2399
+ }
2400
+ });
2401
+ } catch (error) {
2402
+ log.error(`Adapter Exception: ${error}`);
2403
+ done(error);
2404
+ }
2405
+ } else {
2406
+ log.error('driveRevisionsList task is false, skipping test');
2407
+ skipCount += 1;
2408
+ done();
2409
+ }// end if task
2410
+ }).timeout(attemptTimeout);
2411
+ });
2412
+
2413
+ const revisionsRevisionId = 'fakedata';
2414
+ const revisionsDriveRevisionsUpdateBodyParam = {
2415
+ exportLinks: {},
2416
+ id: 'string',
2417
+ keepForever: false,
2418
+ kind: 'drive#revision',
2419
+ lastModifyingUser: {
2420
+ displayName: 'string',
2421
+ emailAddress: 'string',
2422
+ kind: 'drive#user',
2423
+ me: true,
2424
+ permissionId: 'string',
2425
+ photoLink: 'string'
2426
+ },
2427
+ md5Checksum: 'string',
2428
+ mimeType: 'string',
2429
+ modifiedTime: 'string',
2430
+ originalFilename: 'string',
2431
+ publishAuto: false,
2432
+ published: true,
2433
+ publishedLink: 'string',
2434
+ publishedOutsideDomain: true,
2435
+ size: 'string'
2436
+ };
2437
+ describe('#driveRevisionsUpdate - errors', () => {
2438
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2439
+ if (pronghorn.methodsByName.driveRevisionsUpdate.task) {
2440
+ try {
2441
+ a.driveRevisionsUpdate(null, null, null, null, null, null, null, revisionsFileId, revisionsRevisionId, revisionsDriveRevisionsUpdateBodyParam, (data, error) => {
2442
+ try {
2443
+ if (stub) {
2444
+ const displayE = 'Error 400 received on request';
2445
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2446
+ } else {
2447
+ runCommonAsserts(data, error);
2448
+ }
2449
+ saveMockData('Revisions', 'driveRevisionsUpdate', 'default', data);
2450
+ done();
2451
+ } catch (err) {
2452
+ log.error(`Test Failure: ${err}`);
2453
+ done(err);
2454
+ }
2455
+ });
2456
+ } catch (error) {
2457
+ log.error(`Adapter Exception: ${error}`);
2458
+ done(error);
2459
+ }
2460
+ } else {
2461
+ log.error('driveRevisionsUpdate task is false, skipping test');
2462
+ skipCount += 1;
2463
+ done();
2464
+ }// end if task
2465
+ }).timeout(attemptTimeout);
2466
+ });
2467
+
2468
+ describe('#driveRevisionsGet - errors', () => {
2469
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2470
+ if (pronghorn.methodsByName.driveRevisionsGet.task) {
2471
+ try {
2472
+ a.driveRevisionsGet(null, null, null, null, null, null, null, revisionsFileId, revisionsRevisionId, null, (data, error) => {
2473
+ try {
2474
+ if (stub) {
2475
+ const displayE = 'Error 400 received on request';
2476
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2477
+ } else {
2478
+ runCommonAsserts(data, error);
2479
+ }
2480
+ saveMockData('Revisions', 'driveRevisionsGet', 'default', data);
2481
+ done();
2482
+ } catch (err) {
2483
+ log.error(`Test Failure: ${err}`);
2484
+ done(err);
2485
+ }
2486
+ });
2487
+ } catch (error) {
2488
+ log.error(`Adapter Exception: ${error}`);
2489
+ done(error);
2490
+ }
2491
+ } else {
2492
+ log.error('driveRevisionsGet task is false, skipping test');
2493
+ skipCount += 1;
2494
+ done();
2495
+ }// end if task
2496
+ }).timeout(attemptTimeout);
2497
+ });
2498
+
2499
+ const teamdrivesRequestId = 'fakedata';
2500
+ const teamdrivesDriveTeamdrivesCreateBodyParam = {
2501
+ backgroundImageFile: {
2502
+ id: 'string',
2503
+ width: 3,
2504
+ xCoordinate: 5,
2505
+ yCoordinate: 5
2506
+ },
2507
+ backgroundImageLink: 'string',
2508
+ capabilities: {
2509
+ canAddChildren: true,
2510
+ canChangeCopyRequiresWriterPermissionRestriction: true,
2511
+ canChangeDomainUsersOnlyRestriction: true,
2512
+ canChangeTeamDriveBackground: true,
2513
+ canChangeTeamMembersOnlyRestriction: false,
2514
+ canComment: false,
2515
+ canCopy: true,
2516
+ canDeleteChildren: false,
2517
+ canDeleteTeamDrive: false,
2518
+ canDownload: false,
2519
+ canEdit: false,
2520
+ canListChildren: false,
2521
+ canManageMembers: true,
2522
+ canReadRevisions: false,
2523
+ canRemoveChildren: true,
2524
+ canRename: true,
2525
+ canRenameTeamDrive: false,
2526
+ canShare: true,
2527
+ canTrashChildren: true
2528
+ },
2529
+ colorRgb: 'string',
2530
+ createdTime: 'string',
2531
+ id: 'string',
2532
+ kind: 'drive#teamDrive',
2533
+ name: 'string',
2534
+ orgUnitId: 'string',
2535
+ restrictions: {
2536
+ adminManagedRestrictions: false,
2537
+ copyRequiresWriterPermission: false,
2538
+ domainUsersOnly: false,
2539
+ teamMembersOnly: false
2540
+ },
2541
+ themeId: 'string'
2542
+ };
2543
+ describe('#driveTeamdrivesCreate - errors', () => {
2544
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2545
+ if (pronghorn.methodsByName.driveTeamdrivesCreate.task) {
2546
+ try {
2547
+ a.driveTeamdrivesCreate(null, null, null, null, null, null, null, teamdrivesRequestId, teamdrivesDriveTeamdrivesCreateBodyParam, (data, error) => {
2548
+ try {
2549
+ if (stub) {
2550
+ const displayE = 'Error 400 received on request';
2551
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2552
+ } else {
2553
+ runCommonAsserts(data, error);
2554
+ }
2555
+ saveMockData('Teamdrives', 'driveTeamdrivesCreate', 'default', data);
2556
+ done();
2557
+ } catch (err) {
2558
+ log.error(`Test Failure: ${err}`);
2559
+ done(err);
2560
+ }
2561
+ });
2562
+ } catch (error) {
2563
+ log.error(`Adapter Exception: ${error}`);
2564
+ done(error);
2565
+ }
2566
+ } else {
2567
+ log.error('driveTeamdrivesCreate task is false, skipping test');
2568
+ skipCount += 1;
2569
+ done();
2570
+ }// end if task
2571
+ }).timeout(attemptTimeout);
2572
+ });
2573
+
2574
+ describe('#driveTeamdrivesList - errors', () => {
2575
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2576
+ if (pronghorn.methodsByName.driveTeamdrivesList.task) {
2577
+ try {
2578
+ a.driveTeamdrivesList(null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2579
+ try {
2580
+ if (stub) {
2581
+ const displayE = 'Error 400 received on request';
2582
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2583
+ } else {
2584
+ runCommonAsserts(data, error);
2585
+ }
2586
+ saveMockData('Teamdrives', 'driveTeamdrivesList', 'default', data);
2587
+ done();
2588
+ } catch (err) {
2589
+ log.error(`Test Failure: ${err}`);
2590
+ done(err);
2591
+ }
2592
+ });
2593
+ } catch (error) {
2594
+ log.error(`Adapter Exception: ${error}`);
2595
+ done(error);
2596
+ }
2597
+ } else {
2598
+ log.error('driveTeamdrivesList task is false, skipping test');
2599
+ skipCount += 1;
2600
+ done();
2601
+ }// end if task
2602
+ }).timeout(attemptTimeout);
2603
+ });
2604
+
2605
+ const teamdrivesTeamDriveId = 'fakedata';
2606
+ const teamdrivesDriveTeamdrivesUpdateBodyParam = {
2607
+ backgroundImageFile: {
2608
+ id: 'string',
2609
+ width: 2,
2610
+ xCoordinate: 8,
2611
+ yCoordinate: 3
2612
+ },
2613
+ backgroundImageLink: 'string',
2614
+ capabilities: {
2615
+ canAddChildren: false,
2616
+ canChangeCopyRequiresWriterPermissionRestriction: false,
2617
+ canChangeDomainUsersOnlyRestriction: true,
2618
+ canChangeTeamDriveBackground: true,
2619
+ canChangeTeamMembersOnlyRestriction: true,
2620
+ canComment: false,
2621
+ canCopy: false,
2622
+ canDeleteChildren: false,
2623
+ canDeleteTeamDrive: true,
2624
+ canDownload: true,
2625
+ canEdit: true,
2626
+ canListChildren: false,
2627
+ canManageMembers: true,
2628
+ canReadRevisions: true,
2629
+ canRemoveChildren: false,
2630
+ canRename: true,
2631
+ canRenameTeamDrive: false,
2632
+ canShare: true,
2633
+ canTrashChildren: false
2634
+ },
2635
+ colorRgb: 'string',
2636
+ createdTime: 'string',
2637
+ id: 'string',
2638
+ kind: 'drive#teamDrive',
2639
+ name: 'string',
2640
+ orgUnitId: 'string',
2641
+ restrictions: {
2642
+ adminManagedRestrictions: false,
2643
+ copyRequiresWriterPermission: false,
2644
+ domainUsersOnly: true,
2645
+ teamMembersOnly: false
2646
+ },
2647
+ themeId: 'string'
2648
+ };
2649
+ describe('#driveTeamdrivesUpdate - errors', () => {
2650
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2651
+ if (pronghorn.methodsByName.driveTeamdrivesUpdate.task) {
2652
+ try {
2653
+ a.driveTeamdrivesUpdate(null, null, null, null, null, null, null, teamdrivesTeamDriveId, null, teamdrivesDriveTeamdrivesUpdateBodyParam, (data, error) => {
2654
+ try {
2655
+ if (stub) {
2656
+ const displayE = 'Error 400 received on request';
2657
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2658
+ } else {
2659
+ runCommonAsserts(data, error);
2660
+ }
2661
+ saveMockData('Teamdrives', 'driveTeamdrivesUpdate', 'default', data);
2662
+ done();
2663
+ } catch (err) {
2664
+ log.error(`Test Failure: ${err}`);
2665
+ done(err);
2666
+ }
2667
+ });
2668
+ } catch (error) {
2669
+ log.error(`Adapter Exception: ${error}`);
2670
+ done(error);
2671
+ }
2672
+ } else {
2673
+ log.error('driveTeamdrivesUpdate task is false, skipping test');
2674
+ skipCount += 1;
2675
+ done();
2676
+ }// end if task
2677
+ }).timeout(attemptTimeout);
2678
+ });
2679
+
2680
+ describe('#driveTeamdrivesGet - errors', () => {
2681
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2682
+ if (pronghorn.methodsByName.driveTeamdrivesGet.task) {
2683
+ try {
2684
+ a.driveTeamdrivesGet(null, null, null, null, null, null, null, teamdrivesTeamDriveId, null, (data, error) => {
2685
+ try {
2686
+ if (stub) {
2687
+ const displayE = 'Error 400 received on request';
2688
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2689
+ } else {
2690
+ runCommonAsserts(data, error);
2691
+ }
2692
+ saveMockData('Teamdrives', 'driveTeamdrivesGet', 'default', data);
2693
+ done();
2694
+ } catch (err) {
2695
+ log.error(`Test Failure: ${err}`);
2696
+ done(err);
2697
+ }
2698
+ });
2699
+ } catch (error) {
2700
+ log.error(`Adapter Exception: ${error}`);
2701
+ done(error);
2702
+ }
2703
+ } else {
2704
+ log.error('driveTeamdrivesGet task is false, skipping test');
2705
+ skipCount += 1;
2706
+ done();
2707
+ }// end if task
2708
+ }).timeout(attemptTimeout);
2709
+ });
2710
+
2711
+ describe('#driveDrivesDelete - errors', () => {
2712
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2713
+ if (pronghorn.methodsByName.driveDrivesDelete.task) {
2714
+ try {
2715
+ a.driveDrivesDelete(null, null, null, null, null, null, null, drivesDriveId, (data, error) => {
2716
+ try {
2717
+ if (stub) {
2718
+ const displayE = 'Error 400 received on request';
2719
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2720
+ } else {
2721
+ runCommonAsserts(data, error);
2722
+ }
2723
+ saveMockData('Drives', 'driveDrivesDelete', 'default', data);
2724
+ done();
2725
+ } catch (err) {
2726
+ log.error(`Test Failure: ${err}`);
2727
+ done(err);
2728
+ }
2729
+ });
2730
+ } catch (error) {
2731
+ log.error(`Adapter Exception: ${error}`);
2732
+ done(error);
2733
+ }
2734
+ } else {
2735
+ log.error('driveDrivesDelete task is false, skipping test');
2736
+ skipCount += 1;
2737
+ done();
2738
+ }// end if task
2739
+ }).timeout(attemptTimeout);
2740
+ });
2741
+
2742
+ describe('#driveFilesEmptyTrash - errors', () => {
2743
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2744
+ if (pronghorn.methodsByName.driveFilesEmptyTrash.task) {
2745
+ try {
2746
+ a.driveFilesEmptyTrash(null, null, null, null, null, null, null, null, (data, error) => {
2747
+ try {
2748
+ if (stub) {
2749
+ const displayE = 'Error 400 received on request';
2750
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2751
+ } else {
2752
+ runCommonAsserts(data, error);
2753
+ }
2754
+ saveMockData('Files', 'driveFilesEmptyTrash', 'default', data);
2755
+ done();
2756
+ } catch (err) {
2757
+ log.error(`Test Failure: ${err}`);
2758
+ done(err);
2759
+ }
2760
+ });
2761
+ } catch (error) {
2762
+ log.error(`Adapter Exception: ${error}`);
2763
+ done(error);
2764
+ }
2765
+ } else {
2766
+ log.error('driveFilesEmptyTrash task is false, skipping test');
2767
+ skipCount += 1;
2768
+ done();
2769
+ }// end if task
2770
+ }).timeout(attemptTimeout);
2771
+ });
2772
+
2773
+ describe('#driveFilesDelete - errors', () => {
2774
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2775
+ if (pronghorn.methodsByName.driveFilesDelete.task) {
2776
+ try {
2777
+ a.driveFilesDelete(null, null, null, null, null, null, null, filesFileId, null, null, null, (data, error) => {
2778
+ try {
2779
+ if (stub) {
2780
+ const displayE = 'Error 400 received on request';
2781
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2782
+ } else {
2783
+ runCommonAsserts(data, error);
2784
+ }
2785
+ saveMockData('Files', 'driveFilesDelete', 'default', data);
2786
+ done();
2787
+ } catch (err) {
2788
+ log.error(`Test Failure: ${err}`);
2789
+ done(err);
2790
+ }
2791
+ });
2792
+ } catch (error) {
2793
+ log.error(`Adapter Exception: ${error}`);
2794
+ done(error);
2795
+ }
2796
+ } else {
2797
+ log.error('driveFilesDelete task is false, skipping test');
2798
+ skipCount += 1;
2799
+ done();
2800
+ }// end if task
2801
+ }).timeout(attemptTimeout);
2802
+ });
2803
+
2804
+ describe('#driveCommentsDelete - errors', () => {
2805
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2806
+ if (pronghorn.methodsByName.driveCommentsDelete.task) {
2807
+ try {
2808
+ a.driveCommentsDelete(null, null, null, null, null, null, null, commentsFileId, commentsCommentId, (data, error) => {
2809
+ try {
2810
+ if (stub) {
2811
+ const displayE = 'Error 400 received on request';
2812
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2813
+ } else {
2814
+ runCommonAsserts(data, error);
2815
+ }
2816
+ saveMockData('Comments', 'driveCommentsDelete', 'default', data);
2817
+ done();
2818
+ } catch (err) {
2819
+ log.error(`Test Failure: ${err}`);
2820
+ done(err);
2821
+ }
2822
+ });
2823
+ } catch (error) {
2824
+ log.error(`Adapter Exception: ${error}`);
2825
+ done(error);
2826
+ }
2827
+ } else {
2828
+ log.error('driveCommentsDelete task is false, skipping test');
2829
+ skipCount += 1;
2830
+ done();
2831
+ }// end if task
2832
+ }).timeout(attemptTimeout);
2833
+ });
2834
+
2835
+ describe('#driveRepliesDelete - errors', () => {
2836
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2837
+ if (pronghorn.methodsByName.driveRepliesDelete.task) {
2838
+ try {
2839
+ a.driveRepliesDelete(null, null, null, null, null, null, null, repliesFileId, repliesCommentId, repliesReplyId, (data, error) => {
2840
+ try {
2841
+ if (stub) {
2842
+ const displayE = 'Error 400 received on request';
2843
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2844
+ } else {
2845
+ runCommonAsserts(data, error);
2846
+ }
2847
+ saveMockData('Replies', 'driveRepliesDelete', 'default', data);
2848
+ done();
2849
+ } catch (err) {
2850
+ log.error(`Test Failure: ${err}`);
2851
+ done(err);
2852
+ }
2853
+ });
2854
+ } catch (error) {
2855
+ log.error(`Adapter Exception: ${error}`);
2856
+ done(error);
2857
+ }
2858
+ } else {
2859
+ log.error('driveRepliesDelete task is false, skipping test');
2860
+ skipCount += 1;
2861
+ done();
2862
+ }// end if task
2863
+ }).timeout(attemptTimeout);
2864
+ });
2865
+
2866
+ describe('#drivePermissionsDelete - errors', () => {
2867
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2868
+ if (pronghorn.methodsByName.drivePermissionsDelete.task) {
2869
+ try {
2870
+ a.drivePermissionsDelete(null, null, null, null, null, null, null, permissionsFileId, permissionsPermissionId, null, null, null, (data, error) => {
2871
+ try {
2872
+ if (stub) {
2873
+ const displayE = 'Error 400 received on request';
2874
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2875
+ } else {
2876
+ runCommonAsserts(data, error);
2877
+ }
2878
+ saveMockData('Permissions', 'drivePermissionsDelete', 'default', data);
2879
+ done();
2880
+ } catch (err) {
2881
+ log.error(`Test Failure: ${err}`);
2882
+ done(err);
2883
+ }
2884
+ });
2885
+ } catch (error) {
2886
+ log.error(`Adapter Exception: ${error}`);
2887
+ done(error);
2888
+ }
2889
+ } else {
2890
+ log.error('drivePermissionsDelete task is false, skipping test');
2891
+ skipCount += 1;
2892
+ done();
2893
+ }// end if task
2894
+ }).timeout(attemptTimeout);
2895
+ });
2896
+
2897
+ describe('#driveRevisionsDelete - errors', () => {
2898
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2899
+ if (pronghorn.methodsByName.driveRevisionsDelete.task) {
2900
+ try {
2901
+ a.driveRevisionsDelete(null, null, null, null, null, null, null, revisionsFileId, revisionsRevisionId, (data, error) => {
2902
+ try {
2903
+ if (stub) {
2904
+ const displayE = 'Error 400 received on request';
2905
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2906
+ } else {
2907
+ runCommonAsserts(data, error);
2908
+ }
2909
+ saveMockData('Revisions', 'driveRevisionsDelete', 'default', data);
2910
+ done();
2911
+ } catch (err) {
2912
+ log.error(`Test Failure: ${err}`);
2913
+ done(err);
2914
+ }
2915
+ });
2916
+ } catch (error) {
2917
+ log.error(`Adapter Exception: ${error}`);
2918
+ done(error);
2919
+ }
2920
+ } else {
2921
+ log.error('driveRevisionsDelete task is false, skipping test');
2922
+ skipCount += 1;
2923
+ done();
2924
+ }// end if task
2925
+ }).timeout(attemptTimeout);
2926
+ });
2927
+
2928
+ describe('#driveTeamdrivesDelete - errors', () => {
2929
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2930
+ if (pronghorn.methodsByName.driveTeamdrivesDelete.task) {
2931
+ try {
2932
+ a.driveTeamdrivesDelete(null, null, null, null, null, null, null, teamdrivesTeamDriveId, (data, error) => {
2933
+ try {
2934
+ if (stub) {
2935
+ const displayE = 'Error 400 received on request';
2936
+ runErrorAsserts(data, error, 'AD.500', 'Test-google_drive-connectorRest-handleEndResponse', displayE);
2937
+ } else {
2938
+ runCommonAsserts(data, error);
2939
+ }
2940
+ saveMockData('Teamdrives', 'driveTeamdrivesDelete', 'default', data);
2941
+ done();
2942
+ } catch (err) {
2943
+ log.error(`Test Failure: ${err}`);
2944
+ done(err);
2945
+ }
2946
+ });
2947
+ } catch (error) {
2948
+ log.error(`Adapter Exception: ${error}`);
2949
+ done(error);
2950
+ }
2951
+ } else {
2952
+ log.error('driveTeamdrivesDelete task is false, skipping test');
2953
+ skipCount += 1;
2954
+ done();
2955
+ }// end if task
2956
+ }).timeout(attemptTimeout);
2957
+ });
2958
+
2959
+ describe('#Skipped test count', () => {
2960
+ it('count skipped tests', (done) => {
2961
+ console.log(`skipped ${skipCount} tests because \x1b[33mtask: false\x1b[0m`);
2962
+ done();
2963
+ });
2964
+ });
2965
+ });
2966
+ });