@itentialopensource/adapter-bitbucket 0.3.2 → 0.3.5

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 (41) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +24 -0
  4. package/README.md +270 -68
  5. package/adapter.js +2006 -19
  6. package/adapterBase.js +544 -17
  7. package/entities/.generic/action.json +109 -0
  8. package/entities/.generic/schema.json +23 -0
  9. package/entities/.system/action.json +1 -1
  10. package/entities/Repositories/action.json +21 -0
  11. package/entities/Repositories/schema.json +2 -1
  12. package/error.json +6 -0
  13. package/package.json +46 -24
  14. package/pronghorn.json +664 -0
  15. package/propertiesSchema.json +84 -11
  16. package/refs?service=git-upload-pack +0 -0
  17. package/report/bitbucket2.0-OpenApi3Json.json +15713 -0
  18. package/report/updateReport1594060670181.json +95 -0
  19. package/report/updateReport1614703735948.json +95 -0
  20. package/report/updateReport1647122655204.json +95 -0
  21. package/sampleProperties.json +20 -5
  22. package/test/integration/adapterTestBasicGet.js +85 -0
  23. package/test/integration/adapterTestConnectivity.js +93 -0
  24. package/test/integration/adapterTestIntegration.js +30 -11
  25. package/test/unit/adapterBaseTestUnit.js +944 -0
  26. package/test/unit/adapterTestUnit.js +703 -12
  27. package/utils/addAuth.js +94 -0
  28. package/utils/artifactize.js +9 -14
  29. package/utils/basicGet.js +50 -0
  30. package/utils/checkMigrate.js +63 -0
  31. package/utils/entitiesToDB.js +224 -0
  32. package/utils/findPath.js +74 -0
  33. package/utils/modify.js +154 -0
  34. package/utils/packModificationScript.js +1 -1
  35. package/utils/patches2bundledDeps.js +90 -0
  36. package/utils/pre-commit.sh +1 -1
  37. package/utils/removeHooks.js +20 -0
  38. package/utils/tbScript.js +169 -0
  39. package/utils/tbUtils.js +451 -0
  40. package/utils/troubleshootingAdapter.js +190 -0
  41. package/gl-code-quality-report.json +0 -1
@@ -23,7 +23,7 @@ const anything = td.matchers.anything();
23
23
  let logLevel = 'none';
24
24
  const stub = true;
25
25
  const isRapidFail = false;
26
- const attemptTimeout = 120000;
26
+ const attemptTimeout = 600000;
27
27
 
28
28
  // these variables can be changed to run in integrated mode so easier to set them here
29
29
  // always check these in with bogus data!!!
@@ -51,6 +51,7 @@ global.pronghornProps = {
51
51
  base_path: '/api',
52
52
  version: 'v2.0',
53
53
  cache_location: 'none',
54
+ encode_pathvars: true,
54
55
  save_metric: false,
55
56
  stub,
56
57
  protocol,
@@ -63,11 +64,16 @@ global.pronghornProps = {
63
64
  token_timeout: -1,
64
65
  token_cache: 'local',
65
66
  auth_field: 'header.headers.Authorization',
66
- auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
67
+ auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
68
+ auth_logging: false,
69
+ client_id: '',
70
+ client_secret: '',
71
+ grant_type: ''
67
72
  },
68
73
  healthcheck: {
69
74
  type: 'none',
70
- frequency: 60000
75
+ frequency: 60000,
76
+ query_object: {}
71
77
  },
72
78
  throttle: {
73
79
  throttle_enabled: false,
@@ -76,7 +82,13 @@ global.pronghornProps = {
76
82
  max_in_queue: 1000,
77
83
  concurrent_max: 1,
78
84
  expire_timeout: 0,
79
- avg_runtime: 200
85
+ avg_runtime: 200,
86
+ priorities: [
87
+ {
88
+ value: 0,
89
+ percent: 100
90
+ }
91
+ ]
80
92
  },
81
93
  request: {
82
94
  number_redirects: 0,
@@ -92,13 +104,16 @@ global.pronghornProps = {
92
104
  },
93
105
  healthcheck_on_timeout: true,
94
106
  return_raw: true,
95
- archiving: false
107
+ archiving: false,
108
+ return_request: false
96
109
  },
97
110
  proxy: {
98
111
  enabled: false,
99
112
  host: '',
100
113
  port: 1,
101
- protocol: 'http'
114
+ protocol: 'http',
115
+ username: '',
116
+ password: ''
102
117
  },
103
118
  ssl: {
104
119
  ecdhCurve: '',
@@ -161,7 +176,7 @@ process.argv.forEach((val) => {
161
176
  });
162
177
 
163
178
  // need to set global logging
164
- global.log = new (winston.Logger)({
179
+ global.log = winston.createLogger({
165
180
  level: logLevel,
166
181
  levels: myCustomLevels.levels,
167
182
  transports: [
@@ -185,9 +200,8 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
185
200
  assert.equal(displayStr, error.IAPerror.displayString);
186
201
  }
187
202
 
188
-
189
203
  // require the adapter that we are going to be using
190
- const Bitbucket = require('../../adapter.js');
204
+ const Bitbucket = require('../../adapter');
191
205
 
192
206
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
193
207
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -229,6 +243,8 @@ describe('[unit] Bitbucket Adapter Test', () => {
229
243
  try {
230
244
  assert.notEqual(null, a);
231
245
  assert.notEqual(undefined, a);
246
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
247
+ assert.equal(checkId, a.id);
232
248
  assert.notEqual(null, a.allProps);
233
249
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
234
250
  assert.equal(check, a.healthcheckType);
@@ -258,7 +274,7 @@ describe('[unit] Bitbucket Adapter Test', () => {
258
274
  describe('#getWorkflowFunctions', () => {
259
275
  it('should retrieve workflow functions', (done) => {
260
276
  try {
261
- wffunctions = a.getWorkflowFunctions();
277
+ wffunctions = a.getWorkflowFunctions([]);
262
278
 
263
279
  try {
264
280
  assert.notEqual(0, wffunctions.length);
@@ -310,13 +326,103 @@ describe('[unit] Bitbucket Adapter Test', () => {
310
326
  done(error);
311
327
  }
312
328
  });
313
- it('package.json should be customized', (done) => {
329
+ it('package.json standard fields should be customized', (done) => {
314
330
  try {
315
331
  const packageDotJson = require('../../package.json');
316
332
  assert.notEqual(-1, packageDotJson.name.indexOf('bitbucket'));
317
333
  assert.notEqual(undefined, packageDotJson.version);
318
334
  assert.notEqual(null, packageDotJson.version);
319
335
  assert.notEqual('', packageDotJson.version);
336
+ assert.notEqual(undefined, packageDotJson.description);
337
+ assert.notEqual(null, packageDotJson.description);
338
+ assert.notEqual('', packageDotJson.description);
339
+ assert.equal('adapter.js', packageDotJson.main);
340
+ assert.notEqual(undefined, packageDotJson.wizardVersion);
341
+ assert.notEqual(null, packageDotJson.wizardVersion);
342
+ assert.notEqual('', packageDotJson.wizardVersion);
343
+ assert.notEqual(undefined, packageDotJson.engineVersion);
344
+ assert.notEqual(null, packageDotJson.engineVersion);
345
+ assert.notEqual('', packageDotJson.engineVersion);
346
+ assert.equal('http', packageDotJson.adapterType);
347
+ done();
348
+ } catch (error) {
349
+ log.error(`Test Failure: ${error}`);
350
+ done(error);
351
+ }
352
+ });
353
+ it('package.json proper scripts should be provided', (done) => {
354
+ try {
355
+ const packageDotJson = require('../../package.json');
356
+ assert.notEqual(undefined, packageDotJson.scripts);
357
+ assert.notEqual(null, packageDotJson.scripts);
358
+ assert.notEqual('', packageDotJson.scripts);
359
+ assert.equal('node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions', packageDotJson.scripts.preinstall);
360
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
361
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
362
+ assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
363
+ assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
364
+ assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
365
+ assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
366
+ assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
367
+ assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
368
+ assert.equal('npm run deploy', packageDotJson.scripts.build);
369
+ done();
370
+ } catch (error) {
371
+ log.error(`Test Failure: ${error}`);
372
+ done(error);
373
+ }
374
+ });
375
+ it('package.json proper directories should be provided', (done) => {
376
+ try {
377
+ const packageDotJson = require('../../package.json');
378
+ assert.notEqual(undefined, packageDotJson.repository);
379
+ assert.notEqual(null, packageDotJson.repository);
380
+ assert.notEqual('', packageDotJson.repository);
381
+ assert.equal('git', packageDotJson.repository.type);
382
+ assert.equal('git@gitlab.com:itentialopensource/adapters/', packageDotJson.repository.url.substring(0, 43));
383
+ assert.equal('https://gitlab.com/itentialopensource/adapters/', packageDotJson.homepage.substring(0, 47));
384
+ done();
385
+ } catch (error) {
386
+ log.error(`Test Failure: ${error}`);
387
+ done(error);
388
+ }
389
+ });
390
+ it('package.json proper dependencies should be provided', (done) => {
391
+ try {
392
+ const packageDotJson = require('../../package.json');
393
+ assert.notEqual(undefined, packageDotJson.dependencies);
394
+ assert.notEqual(null, packageDotJson.dependencies);
395
+ assert.notEqual('', packageDotJson.dependencies);
396
+ assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
397
+ assert.equal('^0.21.0', packageDotJson.dependencies.axios);
398
+ assert.equal('^2.20.0', packageDotJson.dependencies.commander);
399
+ assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
400
+ assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
401
+ assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
402
+ assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
403
+ assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
404
+ assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
405
+ assert.equal('^7.3.2', packageDotJson.dependencies.semver);
406
+ assert.equal('^3.3.3', packageDotJson.dependencies.winston);
407
+ done();
408
+ } catch (error) {
409
+ log.error(`Test Failure: ${error}`);
410
+ done(error);
411
+ }
412
+ });
413
+ it('package.json proper dev dependencies should be provided', (done) => {
414
+ try {
415
+ const packageDotJson = require('../../package.json');
416
+ assert.notEqual(undefined, packageDotJson.devDependencies);
417
+ assert.notEqual(null, packageDotJson.devDependencies);
418
+ assert.notEqual('', packageDotJson.devDependencies);
419
+ assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
420
+ assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
421
+ assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
422
+ assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
423
+ assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
424
+ assert.equal('^0.6.3', packageDotJson.devDependencies['package-json-validator']);
425
+ assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
320
426
  done();
321
427
  } catch (error) {
322
428
  log.error(`Test Failure: ${error}`);
@@ -341,8 +447,34 @@ describe('[unit] Bitbucket Adapter Test', () => {
341
447
  try {
342
448
  const pronghornDotJson = require('../../pronghorn.json');
343
449
  assert.notEqual(-1, pronghornDotJson.id.indexOf('bitbucket'));
450
+ assert.equal('Adapter', pronghornDotJson.type);
344
451
  assert.equal('Bitbucket', pronghornDotJson.export);
345
452
  assert.equal('Bitbucket', pronghornDotJson.title);
453
+ assert.equal('adapter.js', pronghornDotJson.src);
454
+ done();
455
+ } catch (error) {
456
+ log.error(`Test Failure: ${error}`);
457
+ done(error);
458
+ }
459
+ });
460
+ it('pronghorn.json should contain generic adapter methods', (done) => {
461
+ try {
462
+ const pronghornDotJson = require('../../pronghorn.json');
463
+ assert.notEqual(undefined, pronghornDotJson.methods);
464
+ assert.notEqual(null, pronghornDotJson.methods);
465
+ assert.notEqual('', pronghornDotJson.methods);
466
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
467
+ assert.notEqual(0, pronghornDotJson.methods.length);
468
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'updateAdapterConfiguration'));
469
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'findPath'));
470
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'troubleshoot'));
471
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runHealthcheck'));
472
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runConnectivity'));
473
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runBasicGet'));
474
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'suspend'));
475
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'unsuspend'));
476
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getQueue'));
477
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
346
478
  done();
347
479
  } catch (error) {
348
480
  log.error(`Test Failure: ${error}`);
@@ -364,7 +496,7 @@ describe('[unit] Bitbucket Adapter Test', () => {
364
496
  let wfparams = [];
365
497
 
366
498
  if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
367
- const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.indexOf(')'));
499
+ const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
368
500
  wfparams = temp.split(',');
369
501
 
370
502
  for (let t = 0; t < wfparams.length; t += 1) {
@@ -481,6 +613,117 @@ describe('[unit] Bitbucket Adapter Test', () => {
481
613
  try {
482
614
  const propertiesDotJson = require('../../propertiesSchema.json');
483
615
  assert.equal('adapter-bitbucket', propertiesDotJson.$id);
616
+ assert.equal('object', propertiesDotJson.type);
617
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
618
+ done();
619
+ } catch (error) {
620
+ log.error(`Test Failure: ${error}`);
621
+ done(error);
622
+ }
623
+ });
624
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
625
+ try {
626
+ const propertiesDotJson = require('../../propertiesSchema.json');
627
+ assert.notEqual(undefined, propertiesDotJson.properties);
628
+ assert.notEqual(null, propertiesDotJson.properties);
629
+ assert.notEqual('', propertiesDotJson.properties);
630
+ assert.equal('string', propertiesDotJson.properties.host.type);
631
+ assert.equal('integer', propertiesDotJson.properties.port.type);
632
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
633
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
634
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
635
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
636
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
637
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
638
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
639
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
640
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
641
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
642
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
643
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
644
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
645
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
646
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
647
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
648
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
649
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
650
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
651
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
652
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
653
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
654
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
655
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
656
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
657
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
658
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
659
+ assert.equal('string', propertiesDotJson.properties.version.type);
660
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
661
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
662
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
663
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
664
+ assert.notEqual(undefined, propertiesDotJson.definitions);
665
+ assert.notEqual(null, propertiesDotJson.definitions);
666
+ assert.notEqual('', propertiesDotJson.definitions);
667
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
668
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
669
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
670
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
671
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
672
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
673
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
674
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
675
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
676
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
677
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
678
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
679
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
680
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
681
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
682
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
683
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
684
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
685
+ assert.notEqual(null, propertiesDotJson.definitions.request);
686
+ assert.notEqual('', propertiesDotJson.definitions.request);
687
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
688
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
689
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
690
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
691
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
692
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
693
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
694
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
695
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
696
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
697
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
698
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
699
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
700
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
701
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
702
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
703
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
704
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
705
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
706
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
707
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
708
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
709
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
710
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
711
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
712
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
713
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
714
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
715
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
716
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
717
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
718
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
719
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
720
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
721
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
722
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
723
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
724
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
725
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
726
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
484
727
  done();
485
728
  } catch (error) {
486
729
  log.error(`Test Failure: ${error}`);
@@ -501,6 +744,50 @@ describe('[unit] Bitbucket Adapter Test', () => {
501
744
  done(error);
502
745
  }
503
746
  });
747
+ it('error.json should have standard adapter errors', (done) => {
748
+ try {
749
+ const errorDotJson = require('../../error.json');
750
+ assert.notEqual(undefined, errorDotJson.errors);
751
+ assert.notEqual(null, errorDotJson.errors);
752
+ assert.notEqual('', errorDotJson.errors);
753
+ assert.equal(true, Array.isArray(errorDotJson.errors));
754
+ assert.notEqual(0, errorDotJson.errors.length);
755
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
756
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
757
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
758
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
759
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
760
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
761
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
762
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
763
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
764
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
765
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
766
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
767
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
768
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
769
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
770
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
771
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
772
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
773
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
774
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
775
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
776
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
777
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
778
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
779
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
780
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
781
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
782
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
783
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
784
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
785
+ done();
786
+ } catch (error) {
787
+ log.error(`Test Failure: ${error}`);
788
+ done(error);
789
+ }
790
+ });
504
791
  });
505
792
 
506
793
  describe('sampleProperties.json', () => {
@@ -515,6 +802,119 @@ describe('[unit] Bitbucket Adapter Test', () => {
515
802
  done(error);
516
803
  }
517
804
  });
805
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
806
+ try {
807
+ const sampleDotJson = require('../../sampleProperties.json');
808
+ assert.notEqual(-1, sampleDotJson.id.indexOf('bitbucket'));
809
+ assert.equal('Bitbucket', sampleDotJson.type);
810
+ assert.notEqual(undefined, sampleDotJson.properties);
811
+ assert.notEqual(null, sampleDotJson.properties);
812
+ assert.notEqual('', sampleDotJson.properties);
813
+ assert.notEqual(undefined, sampleDotJson.properties.host);
814
+ assert.notEqual(undefined, sampleDotJson.properties.port);
815
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
816
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
817
+ assert.notEqual(null, sampleDotJson.properties.authentication);
818
+ assert.notEqual('', sampleDotJson.properties.authentication);
819
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
820
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
821
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
822
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
823
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
824
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
825
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
826
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
827
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
828
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
829
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
830
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
831
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
832
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
833
+ assert.notEqual(null, sampleDotJson.properties.ssl);
834
+ assert.notEqual('', sampleDotJson.properties.ssl);
835
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
836
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
837
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
838
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
839
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
840
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
841
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
842
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
843
+
844
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
845
+ assert.notEqual(undefined, sampleDotJson.properties.version);
846
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
847
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
848
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
849
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
850
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
851
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
852
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
853
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
854
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
855
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
856
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
857
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
858
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
859
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
860
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
861
+ assert.notEqual(null, sampleDotJson.properties.throttle);
862
+ assert.notEqual('', sampleDotJson.properties.throttle);
863
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
864
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
865
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
866
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
867
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
868
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
869
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
870
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
871
+ assert.notEqual(undefined, sampleDotJson.properties.request);
872
+ assert.notEqual(null, sampleDotJson.properties.request);
873
+ assert.notEqual('', sampleDotJson.properties.request);
874
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
875
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
876
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
877
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
878
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
879
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
880
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
881
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
882
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
883
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
884
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
885
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
886
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
887
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
888
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
889
+ assert.notEqual(null, sampleDotJson.properties.proxy);
890
+ assert.notEqual('', sampleDotJson.properties.proxy);
891
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
892
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
893
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
894
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
895
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
896
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
897
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
898
+ assert.notEqual(null, sampleDotJson.properties.mongo);
899
+ assert.notEqual('', sampleDotJson.properties.mongo);
900
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
901
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
902
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
903
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
904
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
905
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
906
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
907
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
908
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
909
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
910
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
911
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
912
+ done();
913
+ } catch (error) {
914
+ log.error(`Test Failure: ${error}`);
915
+ done(error);
916
+ }
917
+ });
518
918
  });
519
919
 
520
920
  describe('#checkProperties', () => {
@@ -602,6 +1002,148 @@ describe('[unit] Bitbucket Adapter Test', () => {
602
1002
  });
603
1003
  });
604
1004
 
1005
+ describe('#updateAdapterConfiguration', () => {
1006
+ it('should have a updateAdapterConfiguration function', (done) => {
1007
+ try {
1008
+ assert.equal(true, typeof a.updateAdapterConfiguration === 'function');
1009
+ done();
1010
+ } catch (error) {
1011
+ log.error(`Test Failure: ${error}`);
1012
+ done(error);
1013
+ }
1014
+ });
1015
+ });
1016
+
1017
+ describe('#findPath', () => {
1018
+ it('should have a findPath function', (done) => {
1019
+ try {
1020
+ assert.equal(true, typeof a.findPath === 'function');
1021
+ done();
1022
+ } catch (error) {
1023
+ log.error(`Test Failure: ${error}`);
1024
+ done(error);
1025
+ }
1026
+ });
1027
+ it('findPath should find atleast one path that matches', (done) => {
1028
+ try {
1029
+ a.findPath('{base_path}/{version}', (data, error) => {
1030
+ try {
1031
+ assert.equal(undefined, error);
1032
+ assert.notEqual(undefined, data);
1033
+ assert.notEqual(null, data);
1034
+ assert.equal(true, data.found);
1035
+ assert.notEqual(undefined, data.foundIn);
1036
+ assert.notEqual(null, data.foundIn);
1037
+ assert.notEqual(0, data.foundIn.length);
1038
+ done();
1039
+ } catch (err) {
1040
+ log.error(`Test Failure: ${err}`);
1041
+ done(err);
1042
+ }
1043
+ });
1044
+ } catch (error) {
1045
+ log.error(`Adapter Exception: ${error}`);
1046
+ done(error);
1047
+ }
1048
+ }).timeout(attemptTimeout);
1049
+ });
1050
+
1051
+ describe('#suspend', () => {
1052
+ it('should have a suspend function', (done) => {
1053
+ try {
1054
+ assert.equal(true, typeof a.suspend === 'function');
1055
+ done();
1056
+ } catch (error) {
1057
+ log.error(`Test Failure: ${error}`);
1058
+ done(error);
1059
+ }
1060
+ });
1061
+ });
1062
+
1063
+ describe('#unsuspend', () => {
1064
+ it('should have a unsuspend function', (done) => {
1065
+ try {
1066
+ assert.equal(true, typeof a.unsuspend === 'function');
1067
+ done();
1068
+ } catch (error) {
1069
+ log.error(`Test Failure: ${error}`);
1070
+ done(error);
1071
+ }
1072
+ });
1073
+ });
1074
+
1075
+ describe('#getQueue', () => {
1076
+ it('should have a getQueue function', (done) => {
1077
+ try {
1078
+ assert.equal(true, typeof a.getQueue === 'function');
1079
+ done();
1080
+ } catch (error) {
1081
+ log.error(`Test Failure: ${error}`);
1082
+ done(error);
1083
+ }
1084
+ });
1085
+ });
1086
+
1087
+ describe('#troubleshoot', () => {
1088
+ it('should have a troubleshoot function', (done) => {
1089
+ try {
1090
+ assert.equal(true, typeof a.troubleshoot === 'function');
1091
+ done();
1092
+ } catch (error) {
1093
+ log.error(`Test Failure: ${error}`);
1094
+ done(error);
1095
+ }
1096
+ });
1097
+ });
1098
+
1099
+ describe('#runHealthcheck', () => {
1100
+ it('should have a runHealthcheck function', (done) => {
1101
+ try {
1102
+ assert.equal(true, typeof a.runHealthcheck === 'function');
1103
+ done();
1104
+ } catch (error) {
1105
+ log.error(`Test Failure: ${error}`);
1106
+ done(error);
1107
+ }
1108
+ });
1109
+ });
1110
+
1111
+ describe('#runConnectivity', () => {
1112
+ it('should have a runConnectivity function', (done) => {
1113
+ try {
1114
+ assert.equal(true, typeof a.runConnectivity === 'function');
1115
+ done();
1116
+ } catch (error) {
1117
+ log.error(`Test Failure: ${error}`);
1118
+ done(error);
1119
+ }
1120
+ });
1121
+ });
1122
+
1123
+ describe('#runBasicGet', () => {
1124
+ it('should have a runBasicGet function', (done) => {
1125
+ try {
1126
+ assert.equal(true, typeof a.runBasicGet === 'function');
1127
+ done();
1128
+ } catch (error) {
1129
+ log.error(`Test Failure: ${error}`);
1130
+ done(error);
1131
+ }
1132
+ });
1133
+ });
1134
+
1135
+ describe('#moveEntitiesToDB', () => {
1136
+ it('should have a moveEntitiesToDB function', (done) => {
1137
+ try {
1138
+ assert.equal(true, typeof a.moveEntitiesToDB === 'function');
1139
+ done();
1140
+ } catch (error) {
1141
+ log.error(`Test Failure: ${error}`);
1142
+ done(error);
1143
+ }
1144
+ });
1145
+ });
1146
+
605
1147
  describe('#checkActionFiles', () => {
606
1148
  it('should have a checkActionFiles function', (done) => {
607
1149
  try {
@@ -731,6 +1273,90 @@ describe('[unit] Bitbucket Adapter Test', () => {
731
1273
  // }).timeout(attemptTimeout);
732
1274
  // });
733
1275
 
1276
+ describe('#hasEntities', () => {
1277
+ it('should have a hasEntities function', (done) => {
1278
+ try {
1279
+ assert.equal(true, typeof a.hasEntities === 'function');
1280
+ done();
1281
+ } catch (error) {
1282
+ log.error(`Test Failure: ${error}`);
1283
+ done(error);
1284
+ }
1285
+ });
1286
+ });
1287
+
1288
+ describe('#hasDevices', () => {
1289
+ it('should have a hasDevices function', (done) => {
1290
+ try {
1291
+ assert.equal(true, typeof a.hasDevices === 'function');
1292
+ done();
1293
+ } catch (error) {
1294
+ log.error(`Test Failure: ${error}`);
1295
+ done(error);
1296
+ }
1297
+ });
1298
+ });
1299
+
1300
+ describe('#getDevice', () => {
1301
+ it('should have a getDevice function', (done) => {
1302
+ try {
1303
+ assert.equal(true, typeof a.getDevice === 'function');
1304
+ done();
1305
+ } catch (error) {
1306
+ log.error(`Test Failure: ${error}`);
1307
+ done(error);
1308
+ }
1309
+ });
1310
+ });
1311
+
1312
+ describe('#getDevicesFiltered', () => {
1313
+ it('should have a getDevicesFiltered function', (done) => {
1314
+ try {
1315
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1316
+ done();
1317
+ } catch (error) {
1318
+ log.error(`Test Failure: ${error}`);
1319
+ done(error);
1320
+ }
1321
+ });
1322
+ });
1323
+
1324
+ describe('#isAlive', () => {
1325
+ it('should have a isAlive function', (done) => {
1326
+ try {
1327
+ assert.equal(true, typeof a.isAlive === 'function');
1328
+ done();
1329
+ } catch (error) {
1330
+ log.error(`Test Failure: ${error}`);
1331
+ done(error);
1332
+ }
1333
+ });
1334
+ });
1335
+
1336
+ describe('#getConfig', () => {
1337
+ it('should have a getConfig function', (done) => {
1338
+ try {
1339
+ assert.equal(true, typeof a.getConfig === 'function');
1340
+ done();
1341
+ } catch (error) {
1342
+ log.error(`Test Failure: ${error}`);
1343
+ done(error);
1344
+ }
1345
+ });
1346
+ });
1347
+
1348
+ describe('#getCount', () => {
1349
+ it('should have a getCount function', (done) => {
1350
+ try {
1351
+ assert.equal(true, typeof a.getCount === 'function');
1352
+ done();
1353
+ } catch (error) {
1354
+ log.error(`Test Failure: ${error}`);
1355
+ done(error);
1356
+ }
1357
+ });
1358
+ });
1359
+
734
1360
  /*
735
1361
  -----------------------------------------------------------------------
736
1362
  -----------------------------------------------------------------------
@@ -1238,6 +1864,71 @@ describe('[unit] Bitbucket Adapter Test', () => {
1238
1864
  }).timeout(attemptTimeout);
1239
1865
  });
1240
1866
 
1867
+ describe('#CreateACommitByUploadingAFile ', () => {
1868
+ let un = 'testUsername';
1869
+ let repoSlug = 'testRepo';
1870
+ const message = 'Commmit message';
1871
+ const author = '';
1872
+ const parents = '';
1873
+ const files = { 'file1.txt': 'contents of file 1', 'testfoler/file2.txt': 'contents of file 2' };
1874
+ const branch = '';
1875
+ it('should have a CreateACommitByUploadingAFile function', (done) => {
1876
+ try {
1877
+ assert.equal(true, typeof a.CreateACommitByUploadingAFile === 'function');
1878
+ done();
1879
+ } catch (error) {
1880
+ log.error(`Test Failure: ${error}`);
1881
+ done(error);
1882
+ }
1883
+ }).timeout(attemptTimeout);
1884
+ it('Should run successfully', (done) => {
1885
+ try {
1886
+ a.CreateACommitByUploadingAFile(un, repoSlug, message, author, parents, files, branch, (data, error) => {
1887
+ try {
1888
+ done();
1889
+ } catch (err) {
1890
+ log.error(`Test Failure: ${err}`);
1891
+ done(err);
1892
+ }
1893
+ });
1894
+ } catch (error) {
1895
+ log.error(`Test Failure: ${error}`);
1896
+ done(error);
1897
+ }
1898
+ }).timeout(attemptTimeout);
1899
+ it('Should fail with out username', (done) => {
1900
+ try {
1901
+ un = '';
1902
+ a.CreateACommitByUploadingAFile(un, repoSlug, message, author, parents, files, branch, (data, error) => {
1903
+ if (error.IAPerror.displayString === 'username is required') {
1904
+ done();
1905
+ } else {
1906
+ throw JSON.stringify(error);
1907
+ }
1908
+ });
1909
+ } catch (error) {
1910
+ log.error(`Test Failure: ${error}`);
1911
+ done(error);
1912
+ }
1913
+ }).timeout(attemptTimeout);
1914
+ it('Should fail with out repoSlug', (done) => {
1915
+ try {
1916
+ un = 'testUsername';
1917
+ repoSlug = '';
1918
+ a.CreateACommitByUploadingAFile(un, repoSlug, message, author, parents, files, branch, (data, error) => {
1919
+ if (error.IAPerror.displayString === 'repoSlug is required') {
1920
+ done();
1921
+ } else {
1922
+ throw JSON.stringify(error);
1923
+ }
1924
+ });
1925
+ } catch (error) {
1926
+ log.error(`Test Failure: ${error}`);
1927
+ done(error);
1928
+ }
1929
+ }).timeout(attemptTimeout);
1930
+ });
1931
+
1241
1932
  describe('#putRepositoriesUsernameRepoSlugHooksUid - errors', () => {
1242
1933
  it('should have a putRepositoriesUsernameRepoSlugHooksUid function', (done) => {
1243
1934
  try {