@itentialopensource/adapter-checkpoint_management 0.2.3 → 0.2.6

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 (101) 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 +2607 -49
  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 +5 -5
  10. package/entities/APISettings/action.json +3 -3
  11. package/entities/AccessLayer/action.json +6 -6
  12. package/entities/AccessRole/action.json +6 -6
  13. package/entities/AccessRule/action.json +6 -6
  14. package/entities/AccessSection/action.json +5 -5
  15. package/entities/AddressRange/action.json +6 -6
  16. package/entities/Administrator/action.json +7 -7
  17. package/entities/Application/action.json +6 -6
  18. package/entities/ApplicationCategory/action.json +6 -6
  19. package/entities/ApplicationGroup/action.json +6 -6
  20. package/entities/DNSDomain/action.json +6 -6
  21. package/entities/DataCenter/action.json +4 -4
  22. package/entities/DataCenterObject/action.json +5 -5
  23. package/entities/Domain/action.json +6 -6
  24. package/entities/DynamicObject/action.json +6 -6
  25. package/entities/GlobalAssignment/action.json +7 -7
  26. package/entities/GlobalDomain/action.json +3 -3
  27. package/entities/Group/action.json +6 -6
  28. package/entities/GroupWithExclusion/action.json +6 -6
  29. package/entities/Host/action.json +6 -6
  30. package/entities/IPS/action.json +5 -5
  31. package/entities/IPSExtendedAttributes/action.json +3 -3
  32. package/entities/LoginMessage/action.json +3 -3
  33. package/entities/Misc/action.json +15 -15
  34. package/entities/MultiDomainServerMDS/action.json +3 -3
  35. package/entities/MulticastAddressRange/action.json +6 -6
  36. package/entities/NATRule/action.json +6 -6
  37. package/entities/NATSection/action.json +5 -5
  38. package/entities/Network/action.json +6 -6
  39. package/entities/OPSECApplication/action.json +6 -6
  40. package/entities/Placeholder/action.json +2 -2
  41. package/entities/Policy/action.json +3 -3
  42. package/entities/PolicyPackage/action.json +6 -6
  43. package/entities/SecurityZone/action.json +6 -6
  44. package/entities/ServiceDCERPC/action.json +6 -6
  45. package/entities/ServiceGroup/action.json +6 -6
  46. package/entities/ServiceICMP/action.json +6 -6
  47. package/entities/ServiceICMP6/action.json +6 -6
  48. package/entities/ServiceOther/action.json +6 -6
  49. package/entities/ServiceRPC/action.json +6 -6
  50. package/entities/ServiceSCTP/action.json +6 -6
  51. package/entities/ServiceTCP/action.json +6 -6
  52. package/entities/ServiceUDP/action.json +6 -6
  53. package/entities/Session/action.json +10 -10
  54. package/entities/SessionManagement/action.json +7 -7
  55. package/entities/SimpleGateway/action.json +6 -6
  56. package/entities/Tags/action.json +6 -6
  57. package/entities/ThreatEmulation/action.json +2 -2
  58. package/entities/ThreatException/action.json +6 -6
  59. package/entities/ThreatExceptionGroup/action.json +6 -6
  60. package/entities/ThreatIndicator/action.json +6 -6
  61. package/entities/ThreatLayer/action.json +6 -6
  62. package/entities/ThreatProfile/action.json +6 -6
  63. package/entities/ThreatProtection/action.json +6 -6
  64. package/entities/ThreatRule/action.json +6 -6
  65. package/entities/Time/action.json +6 -6
  66. package/entities/TimeGroup/action.json +6 -6
  67. package/entities/TrustedClient/action.json +6 -6
  68. package/entities/UpdatableObject/action.json +5 -5
  69. package/entities/UpdatableObjectsRepository/action.json +3 -3
  70. package/entities/VPNCommunityMeshed/action.json +6 -6
  71. package/entities/VPNCommunityStar/action.json +6 -6
  72. package/entities/Wildcard/action.json +6 -6
  73. package/error.json +6 -0
  74. package/package.json +46 -24
  75. package/pronghorn.json +570 -0
  76. package/propertiesSchema.json +84 -11
  77. package/refs?service=git-upload-pack +0 -0
  78. package/report/updateReport1594060676288.json +95 -0
  79. package/report/updateReport1614705421970.json +95 -0
  80. package/report/updateReport1646177180887.json +95 -0
  81. package/sampleProperties.json +31 -12
  82. package/test/integration/adapterTestBasicGet.js +85 -0
  83. package/test/integration/adapterTestConnectivity.js +93 -0
  84. package/test/integration/adapterTestIntegration.js +30 -11
  85. package/test/unit/adapterBaseTestUnit.js +944 -0
  86. package/test/unit/adapterTestUnit.js +638 -12
  87. package/utils/addAuth.js +94 -0
  88. package/utils/artifactize.js +9 -14
  89. package/utils/basicGet.js +50 -0
  90. package/utils/checkMigrate.js +63 -0
  91. package/utils/entitiesToDB.js +224 -0
  92. package/utils/findPath.js +74 -0
  93. package/utils/modify.js +154 -0
  94. package/utils/packModificationScript.js +1 -1
  95. package/utils/patches2bundledDeps.js +90 -0
  96. package/utils/pre-commit.sh +1 -1
  97. package/utils/removeHooks.js +20 -0
  98. package/utils/tbScript.js +169 -0
  99. package/utils/tbUtils.js +451 -0
  100. package/utils/troubleshootingAdapter.js +190 -0
  101. package/gl-code-quality-report.json +0 -1
@@ -46,8 +46,16 @@
46
46
  "none"
47
47
  ]
48
48
  },
49
- "save_metric": {
49
+ "encode_pathvars": {
50
50
  "type": "boolean",
51
+ "description": "When true the path variables are encoded in the url",
52
+ "default": true
53
+ },
54
+ "save_metric": {
55
+ "type": [
56
+ "boolean",
57
+ "string"
58
+ ],
51
59
  "description": "When true the metrics collected by the adapter will be stored in mongo or on the filesystem",
52
60
  "default": false
53
61
  },
@@ -104,6 +112,7 @@
104
112
  "enum": [
105
113
  "basic user_password",
106
114
  "static_token",
115
+ "jwt_token",
107
116
  "request_token",
108
117
  "no_authentication"
109
118
  ]
@@ -190,7 +199,10 @@
190
199
  ]
191
200
  },
192
201
  "auth_field": {
193
- "type": "string",
202
+ "type": [
203
+ "string",
204
+ "array"
205
+ ],
194
206
  "description": "The field in which to pass the token",
195
207
  "default": "header.headers.X-AUTH-TOKEN",
196
208
  "examples": [
@@ -202,7 +214,10 @@
202
214
  ]
203
215
  },
204
216
  "auth_field_format": {
205
- "type": "string",
217
+ "type": [
218
+ "string",
219
+ "array"
220
+ ],
206
221
  "description": "The format used to pass the authentication -- variables {token}, {username}, {password} will be replaced with the proper values. {b64}...{/b64} will base64 encode everything between the start and end tag.",
207
222
  "default": "{token}",
208
223
  "examples": [
@@ -212,6 +227,26 @@
212
227
  "Basic {b64}{username}:{password}{/b64}",
213
228
  "token={token}"
214
229
  ]
230
+ },
231
+ "auth_logging": {
232
+ "type": "boolean",
233
+ "description": "This property turns on logging of Authentication Information and should only be true when debugging authentication and connectivity",
234
+ "default": false
235
+ },
236
+ "client_id": {
237
+ "type": "string",
238
+ "description": "The client id for OAuth requests - can also use username depending on schema",
239
+ "default": ""
240
+ },
241
+ "client_secret": {
242
+ "type": "string",
243
+ "description": "The client secret for OAuth requests - can also use password depending on schema",
244
+ "default": ""
245
+ },
246
+ "grant_type": {
247
+ "type": "string",
248
+ "description": "The grant type for OAuth requests - can also provide in schema",
249
+ "default": ""
215
250
  }
216
251
  },
217
252
  "required": [
@@ -311,6 +346,10 @@
311
346
  "examples": [
312
347
  "/api/version/ping"
313
348
  ]
349
+ },
350
+ "query_object": {
351
+ "type": "object",
352
+ "description": "Query object { device: xxxxx } to be placed into the healthcheck, will be converted to query string by the adapter"
314
353
  }
315
354
  },
316
355
  "required": [
@@ -370,7 +409,7 @@
370
409
  "type": "integer",
371
410
  "description": "defines the number of request that Pronghorn can send checkpoint_management at one time",
372
411
  "default": 1,
373
- "minimum": 1,
412
+ "minimum": 0,
374
413
  "maximum": 1000
375
414
  },
376
415
  "expire_timeout": {
@@ -386,6 +425,23 @@
386
425
  "default": 200,
387
426
  "minimum": 50,
388
427
  "maximum": 60000
428
+ },
429
+ "priorities": {
430
+ "type": "array",
431
+ "description": "define your priorities here",
432
+ "items": {
433
+ "type": "object",
434
+ "properties": {
435
+ "value": {
436
+ "type": "number",
437
+ "description": "Defines a priority - this number is what is passed in on a priority request"
438
+ },
439
+ "percent": {
440
+ "type": "number",
441
+ "description": "this is the percent of the queue that comes before the priority request (0 is front of queue, 100 is last in queue)"
442
+ }
443
+ }
444
+ }
389
445
  }
390
446
  },
391
447
  "required": [
@@ -433,11 +489,12 @@
433
489
  "maximum": 20
434
490
  },
435
491
  "limit_retry_error": {
436
- "type": "integer",
437
- "description": "http error status number which defines that no capacity was available and thus after waiting a short interval the adapter can retry the request",
438
- "default": 0,
439
- "minimum": 0,
440
- "maximum": 1000
492
+ "type": [
493
+ "integer",
494
+ "array"
495
+ ],
496
+ "description": "http error status number which defines that no capacity was available and thus after waiting a short interval the adapter can retry the request. Supports an array of numbers or strings including a range provided as '###-###'",
497
+ "default": 0
441
498
  },
442
499
  "failover_codes": {
443
500
  "type": "array",
@@ -489,6 +546,11 @@
489
546
  "type": "boolean",
490
547
  "description": "Archives each request/response and corresponding metrics",
491
548
  "default": false
549
+ },
550
+ "return_request": {
551
+ "type": "boolean",
552
+ "description": "This property turns on returning the response information - need to be carefull in case credentials are in the path",
553
+ "default": false
492
554
  }
493
555
  },
494
556
  "required": [
@@ -529,8 +591,19 @@
529
591
  "http",
530
592
  "https",
531
593
  "socks4",
532
- "socks5"
594
+ "socks5",
595
+ "tls"
533
596
  ]
597
+ },
598
+ "username": {
599
+ "type": "string",
600
+ "description": "username for proxy authentication",
601
+ "default": ""
602
+ },
603
+ "password": {
604
+ "type": "string",
605
+ "description": "password for proxy authentication",
606
+ "default": ""
534
607
  }
535
608
  },
536
609
  "required": [
@@ -582,7 +655,7 @@
582
655
  "description": "The fully qualified path name to the CA file used for SSL",
583
656
  "default": "",
584
657
  "examples": [
585
- "keys/key.pem"
658
+ "security/ca.pem"
586
659
  ]
587
660
  },
588
661
  "key_file": {
Binary file
@@ -0,0 +1,95 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 29
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 5
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 9
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 10
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^4.34.4"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 56
43
+ },
44
+ {
45
+ "owner": "readmeMd",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 530
48
+ },
49
+ {
50
+ "owner": "unitTestJS",
51
+ "description": "Number of lines of code in unit tests",
52
+ "value": 9298
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of unit tests",
57
+ "value": 619
58
+ },
59
+ {
60
+ "owner": "integrationTestJS",
61
+ "description": "Number of lines of code in integration tests",
62
+ "value": 10256
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of integration tests",
67
+ "value": 300
68
+ },
69
+ {
70
+ "owner": "staticFile",
71
+ "description": "Number of lines of code in adapterBase.js",
72
+ "value": 751
73
+ },
74
+ {
75
+ "owner": "staticFile",
76
+ "description": "Number of static files added",
77
+ "value": 18
78
+ },
79
+ {
80
+ "owner": "Overall",
81
+ "description": "Total lines of Code",
82
+ "value": 20305
83
+ },
84
+ {
85
+ "owner": "Overall",
86
+ "description": "Total Tests",
87
+ "value": 919
88
+ },
89
+ {
90
+ "owner": "Overall",
91
+ "description": "Total Files",
92
+ "value": 6
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 29
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 12
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 7
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 21
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^4.39.1"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 61
43
+ },
44
+ {
45
+ "owner": "readmeMd",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 615
48
+ },
49
+ {
50
+ "owner": "unitTestJS",
51
+ "description": "Number of lines of code in unit tests",
52
+ "value": 9305
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of unit tests",
57
+ "value": 619
58
+ },
59
+ {
60
+ "owner": "integrationTestJS",
61
+ "description": "Number of lines of code in integration tests",
62
+ "value": 10263
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of integration tests",
67
+ "value": 300
68
+ },
69
+ {
70
+ "owner": "staticFile",
71
+ "description": "Number of lines of code in adapterBase.js",
72
+ "value": 1007
73
+ },
74
+ {
75
+ "owner": "staticFile",
76
+ "description": "Number of static files added",
77
+ "value": 30
78
+ },
79
+ {
80
+ "owner": "Overall",
81
+ "description": "Total lines of Code",
82
+ "value": 20575
83
+ },
84
+ {
85
+ "owner": "Overall",
86
+ "description": "Total Tests",
87
+ "value": 919
88
+ },
89
+ {
90
+ "owner": "Overall",
91
+ "description": "Total Files",
92
+ "value": 6
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 30
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 13
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 7
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 23
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^4.44.11"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 64
43
+ },
44
+ {
45
+ "owner": "readmeMd",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 688
48
+ },
49
+ {
50
+ "owner": "unitTestJS",
51
+ "description": "Number of lines of code in unit tests",
52
+ "value": 9922
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of unit tests",
57
+ "value": 645
58
+ },
59
+ {
60
+ "owner": "integrationTestJS",
61
+ "description": "Number of lines of code in integration tests",
62
+ "value": 10273
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of integration tests",
67
+ "value": 300
68
+ },
69
+ {
70
+ "owner": "staticFile",
71
+ "description": "Number of lines of code in adapterBase.js",
72
+ "value": 1029
73
+ },
74
+ {
75
+ "owner": "staticFile",
76
+ "description": "Number of static files added",
77
+ "value": 34
78
+ },
79
+ {
80
+ "owner": "Overall",
81
+ "description": "Total lines of Code",
82
+ "value": 21224
83
+ },
84
+ {
85
+ "owner": "Overall",
86
+ "description": "Total Tests",
87
+ "value": 945
88
+ },
89
+ {
90
+ "owner": "Overall",
91
+ "description": "Total Files",
92
+ "value": 6
93
+ }
94
+ ]
95
+ }
@@ -2,28 +2,38 @@
2
2
  "id": "Adapter-checkpoint_management",
3
3
  "type": "CheckpointManagement",
4
4
  "properties": {
5
- "host": "localhost",
5
+ "host": "INSERT CHECKPOINT HOST HERE",
6
6
  "port": 443,
7
7
  "base_path": "/web_api",
8
8
  "version": "",
9
9
  "cache_location": "none",
10
+ "encode_pathvars": true,
10
11
  "save_metric": true,
11
- "stub": true,
12
+ "stub": false,
12
13
  "protocol": "https",
13
14
  "authentication": {
14
15
  "auth_method": "request_token",
15
- "username": "username",
16
- "password": "password",
16
+ "username": "INSERT USER NAME HERE",
17
+ "password": "INSERT PASSWORD HERE",
17
18
  "token": "",
18
- "token_timeout": 600000,
19
+ "token_user_field": "user",
20
+ "token_password_field": "password",
21
+ "token_result_field": "sid",
22
+ "token_URI_path": "/login",
23
+ "invalid_token_error": 400,
24
+ "token_timeout": 300000,
19
25
  "token_cache": "local",
20
- "invalid_token_error": 401,
21
- "auth_field": "header.headers.X-chkp-sid",
22
- "auth_field_format": "{token}"
26
+ "auth_field": "header.headers.x-chkp-sid",
27
+ "auth_field_format": "{token}",
28
+ "auth_logging": false,
29
+ "client_id": "",
30
+ "client_secret": "",
31
+ "grant_type": ""
23
32
  },
24
33
  "healthcheck": {
25
34
  "type": "startup",
26
- "frequency": 60000
35
+ "frequency": 60000,
36
+ "query_object": {}
27
37
  },
28
38
  "throttle": {
29
39
  "throttle_enabled": false,
@@ -32,7 +42,13 @@
32
42
  "max_in_queue": 1000,
33
43
  "concurrent_max": 1,
34
44
  "expire_timeout": 0,
35
- "avg_runtime": 200
45
+ "avg_runtime": 200,
46
+ "priorities": [
47
+ {
48
+ "value": 0,
49
+ "percent": 100
50
+ }
51
+ ]
36
52
  },
37
53
  "request": {
38
54
  "number_redirects": 0,
@@ -48,13 +64,16 @@
48
64
  },
49
65
  "healthcheck_on_timeout": true,
50
66
  "return_raw": false,
51
- "archiving": false
67
+ "archiving": false,
68
+ "return_request": false
52
69
  },
53
70
  "proxy": {
54
71
  "enabled": false,
55
72
  "host": "",
56
73
  "port": 1,
57
- "protocol": "http"
74
+ "protocol": "http",
75
+ "username": "",
76
+ "password": ""
58
77
  },
59
78
  "ssl": {
60
79
  "ecdhCurve": "",
@@ -0,0 +1,85 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe context before after */
4
+ /* eslint global-require: warn */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint import/no-extraneous-dependencies: warn */
7
+ /* eslint import/no-dynamic-require: warn */
8
+ /* eslint import/no-unresolved: warn */
9
+
10
+ const mocha = require('mocha');
11
+ const path = require('path');
12
+ const assert = require('assert');
13
+ const itParam = require('mocha-param');
14
+
15
+ const utils = require('../../utils/tbUtils');
16
+ const basicGet = require('../../utils/basicGet');
17
+ const { name } = require('../../package.json');
18
+ const { methods } = require('../../pronghorn.json');
19
+
20
+ const getPronghornProps = (iapDir) => {
21
+ const { Discovery } = require('@itential/itential-utils');
22
+ console.log('Retrieving properties.json file...');
23
+ const rawProps = require(path.join(iapDir, 'properties.json'));
24
+ console.log('Decrypting properties...');
25
+ const discovery = new Discovery();
26
+ const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
27
+ console.log('Found properties.\n');
28
+ return pronghornProps;
29
+ };
30
+
31
+ let a;
32
+
33
+ describe('[integration] Adapter BasicGET Test', () => {
34
+ context('Testing GET calls without query parameters', () => {
35
+ before(async () => {
36
+ const iapDir = path.join(__dirname, '../../../../../');
37
+ if (!utils.withinIAP(iapDir)) {
38
+ const sampleProperties = require('../../sampleProperties.json');
39
+ const adapter = { properties: sampleProperties };
40
+ a = basicGet.getAdapterInstance(adapter);
41
+ } else {
42
+ const pronghornProps = getPronghornProps(iapDir);
43
+ console.log('Connecting to Database...');
44
+ const database = await basicGet.connect(pronghornProps);
45
+ console.log('Connection established.');
46
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
47
+ { model: name }
48
+ );
49
+ a = basicGet.getAdapterInstance(adapter);
50
+ }
51
+ });
52
+
53
+ after((done) => {
54
+ done();
55
+ });
56
+
57
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
58
+ if (basicGets.length === 0) {
59
+ console.log('No non-parameter GET calls found.');
60
+ process.exit(0);
61
+ }
62
+ const functionNames = basicGets.map((g) => g.name);
63
+ const request = function request(f, ad) {
64
+ return new Promise((resolve, reject) => {
65
+ const getRespCode = (resp) => {
66
+ if (resp) {
67
+ if (resp.metrics.code !== 200) {
68
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
69
+ }
70
+ resolve(resp.metrics.code);
71
+ } else {
72
+ console.log('\x1b[31m', `call ${f} results in failure`);
73
+ reject(new Error(`${f} failed`));
74
+ }
75
+ };
76
+ ad[f](getRespCode, console.log);
77
+ });
78
+ };
79
+
80
+ itParam('GET call should return 200', functionNames, (fname) => {
81
+ console.log(`\t ${fname}`);
82
+ return request(fname, a).then((result) => assert.equal(result, 200));
83
+ });
84
+ });
85
+ });