@itentialopensource/adapter-digicert_pki 0.1.1 → 1.0.0

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 (92) hide show
  1. package/CALLS.md +1245 -0
  2. package/CHANGELOG.md +8 -1
  3. package/adapter.js +13519 -0
  4. package/entities/ACME/action.json +166 -0
  5. package/entities/ACME/mockdatafiles/createAcmeAuthentication-default.json +21 -0
  6. package/entities/ACME/mockdatafiles/getAcmeAuthentication-default.json +21 -0
  7. package/entities/ACME/mockdatafiles/listAcmeAuthentication-default.json +41 -0
  8. package/entities/ACME/mockdatafiles/updateAcmeAuthentication-default.json +21 -0
  9. package/entities/ACME/schema.json +125 -0
  10. package/entities/AuthenticationCACertificates/action.json +107 -0
  11. package/entities/AuthenticationCACertificates/schema.json +155 -0
  12. package/entities/AuthenticationCATemplates/action.json +187 -0
  13. package/entities/AuthenticationCATemplates/mockdatafiles/createAuthenticationCATemplate-default.json +33 -0
  14. package/entities/AuthenticationCATemplates/mockdatafiles/getAuthenticationCATemplate-default.json +33 -0
  15. package/entities/AuthenticationCATemplates/mockdatafiles/updateAuthenticationCATemplate-default.json +33 -0
  16. package/entities/AuthenticationCATemplates/schema.json +137 -0
  17. package/entities/AuthenticationCertificates/action.json +166 -0
  18. package/entities/AuthenticationCertificates/mockdatafiles/addAuthenticationCertificate-default.json +48 -0
  19. package/entities/AuthenticationCertificates/mockdatafiles/getAuthenticationCertificateDetails-default.json +49 -0
  20. package/entities/AuthenticationCertificates/mockdatafiles/listAuthenticationCertificates-default.json +93 -0
  21. package/entities/AuthenticationCertificates/mockdatafiles/updateAuthenticationCertificate-default.json +48 -0
  22. package/entities/AuthenticationCertificates/schema.json +202 -0
  23. package/entities/BatchCertificateEnrollment/action.json +268 -0
  24. package/entities/BatchCertificateEnrollment/mockdatafiles/batchCSREnroll-default.json +22 -0
  25. package/entities/BatchCertificateEnrollment/mockdatafiles/batchEnrollWithKeyGen-default.json +22 -0
  26. package/entities/BatchCertificateEnrollment/mockdatafiles/batchEnrollWithKeyGenMac-default.json +22 -0
  27. package/entities/BatchCertificateEnrollment/mockdatafiles/downloadCertificates-default.json +18 -0
  28. package/entities/BatchCertificateEnrollment/mockdatafiles/getBatchJobSettings-default.json +22 -0
  29. package/entities/BatchCertificateEnrollment/mockdatafiles/regenerateBatchJobPasscode-default.json +22 -0
  30. package/entities/BatchCertificateEnrollment/mockdatafiles/updateBatchJobSettings-default.json +22 -0
  31. package/entities/BatchCertificateEnrollment/schema.json +284 -0
  32. package/entities/CertificateProfiles/action.json +206 -0
  33. package/entities/CertificateProfiles/mockdatafiles/listCertificateProfiles-default.json +219 -0
  34. package/entities/CertificateProfiles/schema.json +116 -0
  35. package/entities/CertificateRequests/action.json +25 -0
  36. package/entities/CertificateRequests/mockdatafiles/getRequestStatus-default.json +5 -0
  37. package/entities/CertificateRequests/schema.json +30 -0
  38. package/entities/CertificateTemplates/action.json +186 -0
  39. package/entities/CertificateTemplates/schema.json +104 -0
  40. package/entities/Certificates/action.json +312 -0
  41. package/entities/Certificates/mockdatafiles/downloadApprovedCertificate-default.json +47 -0
  42. package/entities/Certificates/mockdatafiles/renewBySerial-default.json +23 -0
  43. package/entities/Certificates/mockdatafiles/renewCertificate-default.json +31 -0
  44. package/entities/Certificates/schema.json +462 -0
  45. package/entities/DeviceProfiles/action.json +126 -0
  46. package/entities/DeviceProfiles/mockdatafiles/createDeviceProfile-default.json +28 -0
  47. package/entities/DeviceProfiles/mockdatafiles/getDeviceProfile-default.json +28 -0
  48. package/entities/DeviceProfiles/mockdatafiles/listdeviceprofiles-default.json +53 -0
  49. package/entities/DeviceProfiles/mockdatafiles/updateDeviceProfile-default.json +28 -0
  50. package/entities/DeviceProfiles/schema.json +57 -0
  51. package/entities/Devices/action.json +166 -0
  52. package/entities/Devices/mockdatafiles/archiveDevice-default.json +33 -0
  53. package/entities/Devices/mockdatafiles/disableDevice-default.json +33 -0
  54. package/entities/Devices/mockdatafiles/enableDevice-default.json +33 -0
  55. package/entities/Devices/mockdatafiles/restoreDevice-default.json +33 -0
  56. package/entities/Devices/schema.json +103 -0
  57. package/entities/DevicesV2/action.json +186 -0
  58. package/entities/DevicesV2/mockdatafiles/archiveDeviceV2-default.json +33 -0
  59. package/entities/DevicesV2/mockdatafiles/disableDeviceV2-default.json +33 -0
  60. package/entities/DevicesV2/mockdatafiles/enableDeviceV2-default.json +33 -0
  61. package/entities/DevicesV2/mockdatafiles/restoreDeviceV2-default.json +33 -0
  62. package/entities/DevicesV2/schema.json +115 -0
  63. package/entities/Divisions/action.json +288 -0
  64. package/entities/Divisions/schema.json +164 -0
  65. package/entities/EnrollmentProfilePasscodes/action.json +186 -0
  66. package/entities/EnrollmentProfilePasscodes/schema.json +181 -0
  67. package/entities/EnrollmentProfiles/action.json +191 -0
  68. package/entities/EnrollmentProfiles/mockdatafiles/getEnrollmentProfile-default.json +153 -0
  69. package/entities/EnrollmentProfiles/mockdatafiles/getEnrollmentProfileSpecification-default.json +125 -0
  70. package/entities/EnrollmentProfiles/mockdatafiles/updateEnrollmentProfile-default.json +117 -0
  71. package/entities/EnrollmentProfiles/schema.json +148 -0
  72. package/entities/ExternalBatchCertificateEnrollment/action.json +150 -0
  73. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/batchEnrollExternal-default.json +16 -0
  74. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/downloadByCertificateValue-default.json +154 -0
  75. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/downloadByCommonName-default.json +150 -0
  76. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/downloadByJobIdAndCertificateValue-default.json +36 -0
  77. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/downloadByJobIdAndCommonName-default.json +130 -0
  78. package/entities/ExternalBatchCertificateEnrollment/mockdatafiles/downloadByJobIdAndUniqueId-default.json +42 -0
  79. package/entities/ExternalBatchCertificateEnrollment/schema.json +102 -0
  80. package/entities/Gateways/action.json +187 -0
  81. package/entities/Gateways/schema.json +126 -0
  82. package/entities/ICAs/action.json +46 -0
  83. package/entities/ICAs/schema.json +163 -0
  84. package/entities/OCSPGroups/action.json +167 -0
  85. package/entities/OCSPGroups/schema.json +466 -0
  86. package/package.json +1 -1
  87. package/pronghorn.json +22589 -32
  88. package/refs?service=git-upload-pack +0 -0
  89. package/report/adapterInfo.json +7 -7
  90. package/sampleProperties.json +3 -3
  91. package/test/integration/adapterTestIntegration.js +4544 -0
  92. package/test/unit/adapterTestUnit.js +4866 -0
@@ -1863,5 +1863,4549 @@ describe('[integration] Digicert Adapter Test', () => {
1863
1863
  }
1864
1864
  }).timeout(attemptTimeout);
1865
1865
  });
1866
+
1867
+ describe('#listCertificates - errors', () => {
1868
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1869
+ try {
1870
+ a.listCertificates(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
1871
+ try {
1872
+ if (stub) {
1873
+ const displayE = 'Error 400 received on request';
1874
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
1875
+ } else {
1876
+ runCommonAsserts(data, error);
1877
+ }
1878
+ saveMockData('Certificates', 'listCertificates', 'default', data);
1879
+ done();
1880
+ } catch (err) {
1881
+ log.error(`Test Failure: ${err}`);
1882
+ done(err);
1883
+ }
1884
+ });
1885
+ } catch (error) {
1886
+ log.error(`Adapter Exception: ${error}`);
1887
+ done(error);
1888
+ }
1889
+ }).timeout(attemptTimeout);
1890
+ });
1891
+
1892
+ describe('#getExampleCertificateRequestCertificateID - errors', () => {
1893
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1894
+ try {
1895
+ a.getExampleCertificateRequestCertificateID('fakedata', (data, error) => {
1896
+ try {
1897
+ if (stub) {
1898
+ const displayE = 'Error 400 received on request';
1899
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
1900
+ } else {
1901
+ runCommonAsserts(data, error);
1902
+ }
1903
+ saveMockData('Certificates', 'getExampleCertificateRequestCertificateID', 'default', data);
1904
+ done();
1905
+ } catch (err) {
1906
+ log.error(`Test Failure: ${err}`);
1907
+ done(err);
1908
+ }
1909
+ });
1910
+ } catch (error) {
1911
+ log.error(`Adapter Exception: ${error}`);
1912
+ done(error);
1913
+ }
1914
+ }).timeout(attemptTimeout);
1915
+ });
1916
+
1917
+ const certificatesRenewCertificateBodyParam = {};
1918
+ describe('#renewCertificate - errors', () => {
1919
+ it('should work if integrated or standalone with mockdata', (done) => {
1920
+ try {
1921
+ a.renewCertificate('fakedata', certificatesRenewCertificateBodyParam, (data, error) => {
1922
+ try {
1923
+ if (stub) {
1924
+ runCommonAsserts(data, error);
1925
+ assert.equal('success', data.response);
1926
+ } else {
1927
+ runCommonAsserts(data, error);
1928
+ }
1929
+ saveMockData('Certificates', 'renewCertificate', 'default', data);
1930
+ done();
1931
+ } catch (err) {
1932
+ log.error(`Test Failure: ${err}`);
1933
+ done(err);
1934
+ }
1935
+ });
1936
+ } catch (error) {
1937
+ log.error(`Adapter Exception: ${error}`);
1938
+ done(error);
1939
+ }
1940
+ }).timeout(attemptTimeout);
1941
+ });
1942
+
1943
+ const certificatesRenewBySerialBodyParam = {};
1944
+ describe('#renewBySerial - errors', () => {
1945
+ it('should work if integrated or standalone with mockdata', (done) => {
1946
+ try {
1947
+ a.renewBySerial('fakedata', certificatesRenewBySerialBodyParam, (data, error) => {
1948
+ try {
1949
+ if (stub) {
1950
+ runCommonAsserts(data, error);
1951
+ assert.equal('success', data.response);
1952
+ } else {
1953
+ runCommonAsserts(data, error);
1954
+ }
1955
+ saveMockData('Certificates', 'renewBySerial', 'default', data);
1956
+ done();
1957
+ } catch (err) {
1958
+ log.error(`Test Failure: ${err}`);
1959
+ done(err);
1960
+ }
1961
+ });
1962
+ } catch (error) {
1963
+ log.error(`Adapter Exception: ${error}`);
1964
+ done(error);
1965
+ }
1966
+ }).timeout(attemptTimeout);
1967
+ });
1968
+
1969
+ const certificatesRevokeCertificateBodyParam = {
1970
+ reason: null
1971
+ };
1972
+ describe('#revokeCertificate - errors', () => {
1973
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1974
+ try {
1975
+ a.revokeCertificate('fakedata', certificatesRevokeCertificateBodyParam, (data, error) => {
1976
+ try {
1977
+ if (stub) {
1978
+ const displayE = 'Error 400 received on request';
1979
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
1980
+ } else {
1981
+ runCommonAsserts(data, error);
1982
+ }
1983
+ saveMockData('Certificates', 'revokeCertificate', 'default', data);
1984
+ done();
1985
+ } catch (err) {
1986
+ log.error(`Test Failure: ${err}`);
1987
+ done(err);
1988
+ }
1989
+ });
1990
+ } catch (error) {
1991
+ log.error(`Adapter Exception: ${error}`);
1992
+ done(error);
1993
+ }
1994
+ }).timeout(attemptTimeout);
1995
+ });
1996
+
1997
+ const certificatesUpdateNoteBodyParam = {
1998
+ note: 'Example certificate note'
1999
+ };
2000
+ describe('#updateNote - errors', () => {
2001
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2002
+ try {
2003
+ a.updateNote('fakedata', certificatesUpdateNoteBodyParam, (data, error) => {
2004
+ try {
2005
+ if (stub) {
2006
+ const displayE = 'Error 400 received on request';
2007
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2008
+ } else {
2009
+ runCommonAsserts(data, error);
2010
+ }
2011
+ saveMockData('Certificates', 'updateNote', '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
+ }).timeout(attemptTimeout);
2023
+ });
2024
+
2025
+ const certificatesRevokeCertificateBySerialNumberBodyParam = {
2026
+ reason: null
2027
+ };
2028
+ describe('#revokeCertificateBySerialNumber - errors', () => {
2029
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2030
+ try {
2031
+ a.revokeCertificateBySerialNumber('fakedata', certificatesRevokeCertificateBySerialNumberBodyParam, (data, error) => {
2032
+ try {
2033
+ if (stub) {
2034
+ const displayE = 'Error 400 received on request';
2035
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2036
+ } else {
2037
+ runCommonAsserts(data, error);
2038
+ }
2039
+ saveMockData('Certificates', 'revokeCertificateBySerialNumber', 'default', data);
2040
+ done();
2041
+ } catch (err) {
2042
+ log.error(`Test Failure: ${err}`);
2043
+ done(err);
2044
+ }
2045
+ });
2046
+ } catch (error) {
2047
+ log.error(`Adapter Exception: ${error}`);
2048
+ done(error);
2049
+ }
2050
+ }).timeout(attemptTimeout);
2051
+ });
2052
+
2053
+ describe('#downloadCertificate - errors', () => {
2054
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2055
+ try {
2056
+ a.downloadCertificate('fakedata', 'fakedata', (data, error) => {
2057
+ try {
2058
+ if (stub) {
2059
+ const displayE = 'Error 400 received on request';
2060
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2061
+ } else {
2062
+ runCommonAsserts(data, error);
2063
+ }
2064
+ saveMockData('Certificates', 'downloadCertificate', 'default', data);
2065
+ done();
2066
+ } catch (err) {
2067
+ log.error(`Test Failure: ${err}`);
2068
+ done(err);
2069
+ }
2070
+ });
2071
+ } catch (error) {
2072
+ log.error(`Adapter Exception: ${error}`);
2073
+ done(error);
2074
+ }
2075
+ }).timeout(attemptTimeout);
2076
+ });
2077
+
2078
+ describe('#downloadCertificateBySerialNumber - errors', () => {
2079
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2080
+ try {
2081
+ a.downloadCertificateBySerialNumber('fakedata', 'fakedata', (data, error) => {
2082
+ try {
2083
+ if (stub) {
2084
+ const displayE = 'Error 400 received on request';
2085
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2086
+ } else {
2087
+ runCommonAsserts(data, error);
2088
+ }
2089
+ saveMockData('Certificates', 'downloadCertificateBySerialNumber', 'default', data);
2090
+ done();
2091
+ } catch (err) {
2092
+ log.error(`Test Failure: ${err}`);
2093
+ done(err);
2094
+ }
2095
+ });
2096
+ } catch (error) {
2097
+ log.error(`Adapter Exception: ${error}`);
2098
+ done(error);
2099
+ }
2100
+ }).timeout(attemptTimeout);
2101
+ });
2102
+
2103
+ describe('#importCertificate - errors', () => {
2104
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2105
+ try {
2106
+ a.importCertificate('fakedata', null, (data, error) => {
2107
+ try {
2108
+ if (stub) {
2109
+ const displayE = 'Error 400 received on request';
2110
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2111
+ } else {
2112
+ runCommonAsserts(data, error);
2113
+ }
2114
+ saveMockData('Certificates', 'importCertificate', 'default', data);
2115
+ done();
2116
+ } catch (err) {
2117
+ log.error(`Test Failure: ${err}`);
2118
+ done(err);
2119
+ }
2120
+ });
2121
+ } catch (error) {
2122
+ log.error(`Adapter Exception: ${error}`);
2123
+ done(error);
2124
+ }
2125
+ }).timeout(attemptTimeout);
2126
+ });
2127
+
2128
+ describe('#getImportDetails - errors', () => {
2129
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2130
+ try {
2131
+ a.getImportDetails('fakedata', (data, error) => {
2132
+ try {
2133
+ if (stub) {
2134
+ const displayE = 'Error 400 received on request';
2135
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2136
+ } else {
2137
+ runCommonAsserts(data, error);
2138
+ }
2139
+ saveMockData('Certificates', 'getImportDetails', 'default', data);
2140
+ done();
2141
+ } catch (err) {
2142
+ log.error(`Test Failure: ${err}`);
2143
+ done(err);
2144
+ }
2145
+ });
2146
+ } catch (error) {
2147
+ log.error(`Adapter Exception: ${error}`);
2148
+ done(error);
2149
+ }
2150
+ }).timeout(attemptTimeout);
2151
+ });
2152
+
2153
+ describe('#getCertificateStatus - errors', () => {
2154
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2155
+ try {
2156
+ a.getCertificateStatus('fakedata', (data, error) => {
2157
+ try {
2158
+ if (stub) {
2159
+ const displayE = 'Error 400 received on request';
2160
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2161
+ } else {
2162
+ runCommonAsserts(data, error);
2163
+ }
2164
+ saveMockData('Certificates', 'getCertificateStatus', 'default', data);
2165
+ done();
2166
+ } catch (err) {
2167
+ log.error(`Test Failure: ${err}`);
2168
+ done(err);
2169
+ }
2170
+ });
2171
+ } catch (error) {
2172
+ log.error(`Adapter Exception: ${error}`);
2173
+ done(error);
2174
+ }
2175
+ }).timeout(attemptTimeout);
2176
+ });
2177
+
2178
+ describe('#getCertificateStatusById - errors', () => {
2179
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2180
+ try {
2181
+ a.getCertificateStatusById('fakedata', (data, error) => {
2182
+ try {
2183
+ if (stub) {
2184
+ const displayE = 'Error 400 received on request';
2185
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2186
+ } else {
2187
+ runCommonAsserts(data, error);
2188
+ }
2189
+ saveMockData('Certificates', 'getCertificateStatusById', 'default', data);
2190
+ done();
2191
+ } catch (err) {
2192
+ log.error(`Test Failure: ${err}`);
2193
+ done(err);
2194
+ }
2195
+ });
2196
+ } catch (error) {
2197
+ log.error(`Adapter Exception: ${error}`);
2198
+ done(error);
2199
+ }
2200
+ }).timeout(attemptTimeout);
2201
+ });
2202
+
2203
+ describe('#listCertificatesByCertificateValue - errors', () => {
2204
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2205
+ try {
2206
+ a.listCertificatesByCertificateValue('fakedata', null, null, (data, error) => {
2207
+ try {
2208
+ if (stub) {
2209
+ const displayE = 'Error 400 received on request';
2210
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2211
+ } else {
2212
+ runCommonAsserts(data, error);
2213
+ }
2214
+ saveMockData('Certificates', 'listCertificatesByCertificateValue', 'default', data);
2215
+ done();
2216
+ } catch (err) {
2217
+ log.error(`Test Failure: ${err}`);
2218
+ done(err);
2219
+ }
2220
+ });
2221
+ } catch (error) {
2222
+ log.error(`Adapter Exception: ${error}`);
2223
+ done(error);
2224
+ }
2225
+ }).timeout(attemptTimeout);
2226
+ });
2227
+
2228
+ const certificatesDownloadApprovedCertificateBodyParam = {
2229
+ response_with_certificate_only: false,
2230
+ split_certificate_response: true,
2231
+ include_certificate_chain: true
2232
+ };
2233
+ describe('#downloadApprovedCertificate - errors', () => {
2234
+ it('should work if integrated or standalone with mockdata', (done) => {
2235
+ try {
2236
+ a.downloadApprovedCertificate('fakedata', certificatesDownloadApprovedCertificateBodyParam, (data, error) => {
2237
+ try {
2238
+ if (stub) {
2239
+ runCommonAsserts(data, error);
2240
+ assert.equal('1a4e7b7b-03cf-40ff-a93c-41cc0edf220c', data.response.certificate_request_id);
2241
+ assert.equal('AUTO_APPROVED', data.response.status);
2242
+ assert.equal('SUCCESS', data.response.result);
2243
+ assert.equal('df832ffd-7d5c-4277-99dc-99a1e2b20fc9', data.response.certificate_id);
2244
+ assert.equal('-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n', data.response.pem);
2245
+ assert.equal('MII...', data.response.ica);
2246
+ assert.equal(true, Array.isArray(data.response.chain));
2247
+ assert.equal('<private_key>', data.response.private_key);
2248
+ } else {
2249
+ runCommonAsserts(data, error);
2250
+ }
2251
+ saveMockData('Certificates', 'downloadApprovedCertificate', 'default', data);
2252
+ done();
2253
+ } catch (err) {
2254
+ log.error(`Test Failure: ${err}`);
2255
+ done(err);
2256
+ }
2257
+ });
2258
+ } catch (error) {
2259
+ log.error(`Adapter Exception: ${error}`);
2260
+ done(error);
2261
+ }
2262
+ }).timeout(attemptTimeout);
2263
+ });
2264
+
2265
+ describe('#listAuthenticationCACertificates - errors', () => {
2266
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2267
+ try {
2268
+ a.listAuthenticationCACertificates(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2269
+ try {
2270
+ if (stub) {
2271
+ const displayE = 'Error 400 received on request';
2272
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2273
+ } else {
2274
+ runCommonAsserts(data, error);
2275
+ }
2276
+ saveMockData('AuthenticationCACertificates', 'listAuthenticationCACertificates', 'default', data);
2277
+ done();
2278
+ } catch (err) {
2279
+ log.error(`Test Failure: ${err}`);
2280
+ done(err);
2281
+ }
2282
+ });
2283
+ } catch (error) {
2284
+ log.error(`Adapter Exception: ${error}`);
2285
+ done(error);
2286
+ }
2287
+ }).timeout(attemptTimeout);
2288
+ });
2289
+
2290
+ describe('#listAuthenticationCACertificatesByAccount - errors', () => {
2291
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2292
+ try {
2293
+ a.listAuthenticationCACertificatesByAccount('fakedata', null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2294
+ try {
2295
+ if (stub) {
2296
+ const displayE = 'Error 400 received on request';
2297
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2298
+ } else {
2299
+ runCommonAsserts(data, error);
2300
+ }
2301
+ saveMockData('AuthenticationCACertificates', 'listAuthenticationCACertificatesByAccount', 'default', data);
2302
+ done();
2303
+ } catch (err) {
2304
+ log.error(`Test Failure: ${err}`);
2305
+ done(err);
2306
+ }
2307
+ });
2308
+ } catch (error) {
2309
+ log.error(`Adapter Exception: ${error}`);
2310
+ done(error);
2311
+ }
2312
+ }).timeout(attemptTimeout);
2313
+ });
2314
+
2315
+ describe('#uploadAuthenticationCACertificate - errors', () => {
2316
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2317
+ try {
2318
+ a.uploadAuthenticationCACertificate('fakedata', null, (data, error) => {
2319
+ try {
2320
+ if (stub) {
2321
+ const displayE = 'Error 400 received on request';
2322
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2323
+ } else {
2324
+ runCommonAsserts(data, error);
2325
+ }
2326
+ saveMockData('AuthenticationCACertificates', 'uploadAuthenticationCACertificate', 'default', data);
2327
+ done();
2328
+ } catch (err) {
2329
+ log.error(`Test Failure: ${err}`);
2330
+ done(err);
2331
+ }
2332
+ });
2333
+ } catch (error) {
2334
+ log.error(`Adapter Exception: ${error}`);
2335
+ done(error);
2336
+ }
2337
+ }).timeout(attemptTimeout);
2338
+ });
2339
+
2340
+ describe('#getAuthenticationCACertificate - errors', () => {
2341
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2342
+ try {
2343
+ a.getAuthenticationCACertificate('fakedata', 'fakedata', (data, error) => {
2344
+ try {
2345
+ if (stub) {
2346
+ const displayE = 'Error 400 received on request';
2347
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2348
+ } else {
2349
+ runCommonAsserts(data, error);
2350
+ }
2351
+ saveMockData('AuthenticationCACertificates', 'getAuthenticationCACertificate', 'default', data);
2352
+ done();
2353
+ } catch (err) {
2354
+ log.error(`Test Failure: ${err}`);
2355
+ done(err);
2356
+ }
2357
+ });
2358
+ } catch (error) {
2359
+ log.error(`Adapter Exception: ${error}`);
2360
+ done(error);
2361
+ }
2362
+ }).timeout(attemptTimeout);
2363
+ });
2364
+
2365
+ describe('#deleteAuthenticationCACertificate - errors', () => {
2366
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2367
+ try {
2368
+ a.deleteAuthenticationCACertificate('fakedata', 'fakedata', (data, error) => {
2369
+ try {
2370
+ if (stub) {
2371
+ const displayE = 'Error 400 received on request';
2372
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2373
+ } else {
2374
+ runCommonAsserts(data, error);
2375
+ }
2376
+ saveMockData('AuthenticationCACertificates', 'deleteAuthenticationCACertificate', 'default', data);
2377
+ done();
2378
+ } catch (err) {
2379
+ log.error(`Test Failure: ${err}`);
2380
+ done(err);
2381
+ }
2382
+ });
2383
+ } catch (error) {
2384
+ log.error(`Adapter Exception: ${error}`);
2385
+ done(error);
2386
+ }
2387
+ }).timeout(attemptTimeout);
2388
+ });
2389
+
2390
+ const authenticationCATemplatesCreateAuthenticationCATemplateBodyParam = {
2391
+ enrollment_profile_id: 'IOT_502ac648-c826-4e71-991e-5629a23850c1',
2392
+ ica_id: '64a17c67-44b9-4ac1-b5a0-4f3fcb2e851b',
2393
+ ica_body: 'string',
2394
+ name: 'Example authentication CA template',
2395
+ can_be_used_for_any_certificate: true
2396
+ };
2397
+ describe('#createAuthenticationCATemplate - errors', () => {
2398
+ it('should work if integrated or standalone with mockdata', (done) => {
2399
+ try {
2400
+ a.createAuthenticationCATemplate(authenticationCATemplatesCreateAuthenticationCATemplateBodyParam, (data, error) => {
2401
+ try {
2402
+ if (stub) {
2403
+ runCommonAsserts(data, error);
2404
+ assert.equal('55f6e0e5-8cbf-4f7b-a623-f5b9689a0dc2', data.response.id);
2405
+ assert.equal('Example authentication CA template', data.response.name);
2406
+ assert.equal(true, Array.isArray(data.response.certificate_attributes));
2407
+ assert.equal(true, Array.isArray(data.response.registered_values));
2408
+ assert.equal('IOT_58b96f06-bf12-49a4-939e-7247f147ec3e', data.response.enrollment_profile_id);
2409
+ assert.equal('Example enrollment profile', data.response.enrollment_profile_name);
2410
+ assert.equal('IoT Example ICA', data.response.ica_common_name);
2411
+ assert.equal('-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n', data.response.ica_body);
2412
+ assert.equal('IoT Example Organization', data.response.organization);
2413
+ assert.equal('IoT Example Root', data.response.parent_ca);
2414
+ assert.equal('1.2.840.10045.4.3.2', data.response.signature_algorithm);
2415
+ assert.equal('EC prime256v1', data.response.key_type);
2416
+ assert.equal(false, data.response.can_be_used_for_any_certificate);
2417
+ assert.equal('certificate_body_and_attributes', data.response.certificate_authentication_type);
2418
+ assert.equal(20, data.response.usage_limit);
2419
+ assert.equal('2022-07-21T00:00:00Z', data.response.start_date);
2420
+ assert.equal('2022-07-31T00:00:00Z', data.response.end_date);
2421
+ assert.equal('2049-01-01', data.response.expiry_date);
2422
+ assert.equal('ACTIVE', data.response.status);
2423
+ assert.equal('2022-07-21T10:09:13Z', data.response.created_at);
2424
+ assert.equal(false, data.response.force_passcode_for_auth_cert);
2425
+ } else {
2426
+ runCommonAsserts(data, error);
2427
+ }
2428
+ saveMockData('AuthenticationCATemplates', 'createAuthenticationCATemplate', 'default', data);
2429
+ done();
2430
+ } catch (err) {
2431
+ log.error(`Test Failure: ${err}`);
2432
+ done(err);
2433
+ }
2434
+ });
2435
+ } catch (error) {
2436
+ log.error(`Adapter Exception: ${error}`);
2437
+ done(error);
2438
+ }
2439
+ }).timeout(attemptTimeout);
2440
+ });
2441
+
2442
+ describe('#listAuthenticationCATemplate - errors', () => {
2443
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2444
+ try {
2445
+ a.listAuthenticationCATemplate(null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2446
+ try {
2447
+ if (stub) {
2448
+ const displayE = 'Error 400 received on request';
2449
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2450
+ } else {
2451
+ runCommonAsserts(data, error);
2452
+ }
2453
+ saveMockData('AuthenticationCATemplates', 'listAuthenticationCATemplate', 'default', data);
2454
+ done();
2455
+ } catch (err) {
2456
+ log.error(`Test Failure: ${err}`);
2457
+ done(err);
2458
+ }
2459
+ });
2460
+ } catch (error) {
2461
+ log.error(`Adapter Exception: ${error}`);
2462
+ done(error);
2463
+ }
2464
+ }).timeout(attemptTimeout);
2465
+ });
2466
+
2467
+ const authenticationCATemplatesUpdateAuthenticationCATemplateBodyParam = {
2468
+ name: 'Example authentication CA template',
2469
+ can_be_used_for_any_certificate: true,
2470
+ certificate_authentication_type: null,
2471
+ certificate_attributes: [
2472
+ 'subject.email'
2473
+ ],
2474
+ usage_limit: 9,
2475
+ start_date: '2021-01-01T00:00:00Z',
2476
+ end_date: '2021-01-01T00:00:00Z',
2477
+ registered_values: [
2478
+ {
2479
+ certificate_field: null,
2480
+ value: 'example'
2481
+ }
2482
+ ],
2483
+ force_passcode_for_auth_cert: true
2484
+ };
2485
+ describe('#updateAuthenticationCATemplate - errors', () => {
2486
+ it('should work if integrated or standalone with mockdata', (done) => {
2487
+ try {
2488
+ a.updateAuthenticationCATemplate('fakedata', authenticationCATemplatesUpdateAuthenticationCATemplateBodyParam, (data, error) => {
2489
+ try {
2490
+ if (stub) {
2491
+ runCommonAsserts(data, error);
2492
+ assert.equal('success', data.response);
2493
+ } else {
2494
+ runCommonAsserts(data, error);
2495
+ }
2496
+ saveMockData('AuthenticationCATemplates', 'updateAuthenticationCATemplate', 'default', data);
2497
+ done();
2498
+ } catch (err) {
2499
+ log.error(`Test Failure: ${err}`);
2500
+ done(err);
2501
+ }
2502
+ });
2503
+ } catch (error) {
2504
+ log.error(`Adapter Exception: ${error}`);
2505
+ done(error);
2506
+ }
2507
+ }).timeout(attemptTimeout);
2508
+ });
2509
+
2510
+ describe('#getAuthenticationCATemplate - errors', () => {
2511
+ it('should work if integrated or standalone with mockdata', (done) => {
2512
+ try {
2513
+ a.getAuthenticationCATemplate('fakedata', (data, error) => {
2514
+ try {
2515
+ if (stub) {
2516
+ runCommonAsserts(data, error);
2517
+ assert.equal('55f6e0e5-8cbf-4f7b-a623-f5b9689a0dc2', data.response.id);
2518
+ assert.equal('Example authentication CA template', data.response.name);
2519
+ assert.equal(true, Array.isArray(data.response.certificate_attributes));
2520
+ assert.equal(true, Array.isArray(data.response.registered_values));
2521
+ assert.equal('IOT_58b96f06-bf12-49a4-939e-7247f147ec3e', data.response.enrollment_profile_id);
2522
+ assert.equal('Example enrollment profile', data.response.enrollment_profile_name);
2523
+ assert.equal('IoT Example ICA', data.response.ica_common_name);
2524
+ assert.equal('-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n', data.response.ica_body);
2525
+ assert.equal('IoT Example Organization', data.response.organization);
2526
+ assert.equal('IoT Example Root', data.response.parent_ca);
2527
+ assert.equal('1.2.840.10045.4.3.2', data.response.signature_algorithm);
2528
+ assert.equal('EC prime256v1', data.response.key_type);
2529
+ assert.equal(false, data.response.can_be_used_for_any_certificate);
2530
+ assert.equal('certificate_body_and_attributes', data.response.certificate_authentication_type);
2531
+ assert.equal(20, data.response.usage_limit);
2532
+ assert.equal('2022-07-21T00:00:00Z', data.response.start_date);
2533
+ assert.equal('2022-07-31T00:00:00Z', data.response.end_date);
2534
+ assert.equal('2049-01-01', data.response.expiry_date);
2535
+ assert.equal('ACTIVE', data.response.status);
2536
+ assert.equal('2022-07-21T10:09:13Z', data.response.created_at);
2537
+ assert.equal(false, data.response.force_passcode_for_auth_cert);
2538
+ } else {
2539
+ runCommonAsserts(data, error);
2540
+ }
2541
+ saveMockData('AuthenticationCATemplates', 'getAuthenticationCATemplate', 'default', data);
2542
+ done();
2543
+ } catch (err) {
2544
+ log.error(`Test Failure: ${err}`);
2545
+ done(err);
2546
+ }
2547
+ });
2548
+ } catch (error) {
2549
+ log.error(`Adapter Exception: ${error}`);
2550
+ done(error);
2551
+ }
2552
+ }).timeout(attemptTimeout);
2553
+ });
2554
+
2555
+ describe('#disableAuthenticationCATemplate - errors', () => {
2556
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2557
+ try {
2558
+ a.disableAuthenticationCATemplate('fakedata', (data, error) => {
2559
+ try {
2560
+ if (stub) {
2561
+ const displayE = 'Error 400 received on request';
2562
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2563
+ } else {
2564
+ runCommonAsserts(data, error);
2565
+ }
2566
+ saveMockData('AuthenticationCATemplates', 'disableAuthenticationCATemplate', 'default', data);
2567
+ done();
2568
+ } catch (err) {
2569
+ log.error(`Test Failure: ${err}`);
2570
+ done(err);
2571
+ }
2572
+ });
2573
+ } catch (error) {
2574
+ log.error(`Adapter Exception: ${error}`);
2575
+ done(error);
2576
+ }
2577
+ }).timeout(attemptTimeout);
2578
+ });
2579
+
2580
+ describe('#deleteAuthenticationCATemplate - errors', () => {
2581
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2582
+ try {
2583
+ a.deleteAuthenticationCATemplate('fakedata', (data, error) => {
2584
+ try {
2585
+ if (stub) {
2586
+ const displayE = 'Error 400 received on request';
2587
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2588
+ } else {
2589
+ runCommonAsserts(data, error);
2590
+ }
2591
+ saveMockData('AuthenticationCATemplates', 'deleteAuthenticationCATemplate', 'default', data);
2592
+ done();
2593
+ } catch (err) {
2594
+ log.error(`Test Failure: ${err}`);
2595
+ done(err);
2596
+ }
2597
+ });
2598
+ } catch (error) {
2599
+ log.error(`Adapter Exception: ${error}`);
2600
+ done(error);
2601
+ }
2602
+ }).timeout(attemptTimeout);
2603
+ });
2604
+
2605
+ describe('#restoreAuthenticationCATemplate - errors', () => {
2606
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2607
+ try {
2608
+ a.restoreAuthenticationCATemplate('fakedata', (data, error) => {
2609
+ try {
2610
+ if (stub) {
2611
+ const displayE = 'Error 400 received on request';
2612
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2613
+ } else {
2614
+ runCommonAsserts(data, error);
2615
+ }
2616
+ saveMockData('AuthenticationCATemplates', 'restoreAuthenticationCATemplate', 'default', data);
2617
+ done();
2618
+ } catch (err) {
2619
+ log.error(`Test Failure: ${err}`);
2620
+ done(err);
2621
+ }
2622
+ });
2623
+ } catch (error) {
2624
+ log.error(`Adapter Exception: ${error}`);
2625
+ done(error);
2626
+ }
2627
+ }).timeout(attemptTimeout);
2628
+ });
2629
+
2630
+ describe('#enableAuthenticationCATemplate - errors', () => {
2631
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2632
+ try {
2633
+ a.enableAuthenticationCATemplate('fakedata', (data, error) => {
2634
+ try {
2635
+ if (stub) {
2636
+ const displayE = 'Error 400 received on request';
2637
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2638
+ } else {
2639
+ runCommonAsserts(data, error);
2640
+ }
2641
+ saveMockData('AuthenticationCATemplates', 'enableAuthenticationCATemplate', 'default', data);
2642
+ done();
2643
+ } catch (err) {
2644
+ log.error(`Test Failure: ${err}`);
2645
+ done(err);
2646
+ }
2647
+ });
2648
+ } catch (error) {
2649
+ log.error(`Adapter Exception: ${error}`);
2650
+ done(error);
2651
+ }
2652
+ }).timeout(attemptTimeout);
2653
+ });
2654
+
2655
+ describe('#listAssignableAuthenticationCACertificates - errors', () => {
2656
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2657
+ try {
2658
+ a.listAssignableAuthenticationCACertificates('fakedata', null, null, null, (data, error) => {
2659
+ try {
2660
+ if (stub) {
2661
+ const displayE = 'Error 400 received on request';
2662
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2663
+ } else {
2664
+ runCommonAsserts(data, error);
2665
+ }
2666
+ saveMockData('AuthenticationCATemplates', 'listAssignableAuthenticationCACertificates', 'default', data);
2667
+ done();
2668
+ } catch (err) {
2669
+ log.error(`Test Failure: ${err}`);
2670
+ done(err);
2671
+ }
2672
+ });
2673
+ } catch (error) {
2674
+ log.error(`Adapter Exception: ${error}`);
2675
+ done(error);
2676
+ }
2677
+ }).timeout(attemptTimeout);
2678
+ });
2679
+
2680
+ const authenticationCertificatesAddAuthenticationCertificateBodyParam = {
2681
+ template_id: '<template_id>',
2682
+ pem: '<pem>',
2683
+ name: 'Example Authentication Certificate',
2684
+ start_date: '2021-05-20T00:00:00Z',
2685
+ end_date: '2022-05-20T00:00:00Z',
2686
+ registered_values: [
2687
+ {
2688
+ certificate_field: 'subject.common_name',
2689
+ matcher: 'equals',
2690
+ value: 'common name registered value'
2691
+ },
2692
+ {
2693
+ certificate_field: 'subject.organization_unit',
2694
+ matcher: 'equals',
2695
+ value: [
2696
+ 'Unit 1',
2697
+ 'Unit 2'
2698
+ ]
2699
+ }
2700
+ ]
2701
+ };
2702
+ describe('#addAuthenticationCertificate - errors', () => {
2703
+ it('should work if integrated or standalone with mockdata', (done) => {
2704
+ try {
2705
+ a.addAuthenticationCertificate(authenticationCertificatesAddAuthenticationCertificateBodyParam, (data, error) => {
2706
+ try {
2707
+ if (stub) {
2708
+ runCommonAsserts(data, error);
2709
+ assert.equal('<template_id>', data.response.template_id);
2710
+ assert.equal('<authentication_certificate_id>', data.response.id);
2711
+ assert.equal('Example Name', data.response.name);
2712
+ assert.equal('object', typeof data.response.enrollment_profile);
2713
+ assert.equal('2021-05-20T00:00:00Z', data.response.start_date);
2714
+ assert.equal('2022-05-20T00:00:00Z', data.response.end_date);
2715
+ assert.equal('0', data.response.usage_limit);
2716
+ assert.equal(true, Array.isArray(data.response.registered_values));
2717
+ assert.equal('0', data.response.number_of_usage);
2718
+ assert.equal('ACTIVE', data.response.status);
2719
+ assert.equal('2021-05-13T21:05:43.273689Z', data.response.created_at);
2720
+ assert.equal('Issuing CA Name', data.response.certificate_issuer_common_name);
2721
+ assert.equal(false, data.response.use_passcode);
2722
+ assert.equal('string', data.response.generation_option);
2723
+ assert.equal('ExamplePasscode123', data.response.passcode);
2724
+ assert.equal(20, data.response.passcode_length);
2725
+ assert.equal('object', typeof data.response.certificate);
2726
+ assert.equal('<pem>', data.response.pem);
2727
+ assert.equal('2022-04-30T17:38:58Z', data.response.certificate_expires_on);
2728
+ assert.equal('<certificate_serial_number>', data.response.certificate_serial_number);
2729
+ assert.equal('ISSUED', data.response.certificate_status);
2730
+ assert.equal('<certificate_thumbprint>', data.response.certificate_thumbprint);
2731
+ assert.equal('Example Organization', data.response.certificate_organization);
2732
+ assert.equal(true, Array.isArray(data.response.certificate_organization_units));
2733
+ } else {
2734
+ runCommonAsserts(data, error);
2735
+ }
2736
+ saveMockData('AuthenticationCertificates', 'addAuthenticationCertificate', 'default', data);
2737
+ done();
2738
+ } catch (err) {
2739
+ log.error(`Test Failure: ${err}`);
2740
+ done(err);
2741
+ }
2742
+ });
2743
+ } catch (error) {
2744
+ log.error(`Adapter Exception: ${error}`);
2745
+ done(error);
2746
+ }
2747
+ }).timeout(attemptTimeout);
2748
+ });
2749
+
2750
+ describe('#listAuthenticationCertificates - errors', () => {
2751
+ it('should work if integrated or standalone with mockdata', (done) => {
2752
+ try {
2753
+ a.listAuthenticationCertificates(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2754
+ try {
2755
+ if (stub) {
2756
+ runCommonAsserts(data, error);
2757
+ assert.equal(20, data.response.limit);
2758
+ assert.equal(0, data.response.offset);
2759
+ assert.equal(true, data.response.pagination);
2760
+ assert.equal(false, data.response.next);
2761
+ assert.equal(1, data.response.total);
2762
+ assert.equal(true, Array.isArray(data.response.records));
2763
+ } else {
2764
+ runCommonAsserts(data, error);
2765
+ }
2766
+ saveMockData('AuthenticationCertificates', 'listAuthenticationCertificates', 'default', data);
2767
+ done();
2768
+ } catch (err) {
2769
+ log.error(`Test Failure: ${err}`);
2770
+ done(err);
2771
+ }
2772
+ });
2773
+ } catch (error) {
2774
+ log.error(`Adapter Exception: ${error}`);
2775
+ done(error);
2776
+ }
2777
+ }).timeout(attemptTimeout);
2778
+ });
2779
+
2780
+ describe('#getAuthenticationCertificateDetails - errors', () => {
2781
+ it('should work if integrated or standalone with mockdata', (done) => {
2782
+ try {
2783
+ a.getAuthenticationCertificateDetails('fakedata', (data, error) => {
2784
+ try {
2785
+ if (stub) {
2786
+ runCommonAsserts(data, error);
2787
+ assert.equal('<template_id>', data.response.template_id);
2788
+ assert.equal('<authentication_certificate_id>', data.response.id);
2789
+ assert.equal('Example Name', data.response.name);
2790
+ assert.equal('object', typeof data.response.enrollment_profile);
2791
+ assert.equal('2021-05-20T00:00:00Z', data.response.start_date);
2792
+ assert.equal('2022-05-20T00:00:00Z', data.response.end_date);
2793
+ assert.equal('0', data.response.usage_limit);
2794
+ assert.equal(true, Array.isArray(data.response.registered_values));
2795
+ assert.equal('0', data.response.number_of_usage);
2796
+ assert.equal('ACTIVE', data.response.status);
2797
+ assert.equal('2021-05-13T21:05:43.273689Z', data.response.created_at);
2798
+ assert.equal('Issuing CA Name', data.response.certificate_issuer_common_name);
2799
+ assert.equal(false, data.response.use_passcode);
2800
+ assert.equal('string', data.response.generation_option);
2801
+ assert.equal('ExamplePasscode123', data.response.passcode);
2802
+ assert.equal(20, data.response.passcode_length);
2803
+ assert.equal('object', typeof data.response.certificate);
2804
+ assert.equal('<pem>', data.response.pem);
2805
+ assert.equal('2022-04-30T17:38:58Z', data.response.certificate_expires_on);
2806
+ assert.equal('<certificate_serial_number>', data.response.certificate_serial_number);
2807
+ assert.equal('ISSUED', data.response.certificate_status);
2808
+ assert.equal('<certificate_thumbprint>', data.response.certificate_thumbprint);
2809
+ assert.equal('Example Organization', data.response.certificate_organization);
2810
+ assert.equal(true, Array.isArray(data.response.certificate_organization_units));
2811
+ assert.equal(true, Array.isArray(data.response.certificate_attributes));
2812
+ } else {
2813
+ runCommonAsserts(data, error);
2814
+ }
2815
+ saveMockData('AuthenticationCertificates', 'getAuthenticationCertificateDetails', 'default', data);
2816
+ done();
2817
+ } catch (err) {
2818
+ log.error(`Test Failure: ${err}`);
2819
+ done(err);
2820
+ }
2821
+ });
2822
+ } catch (error) {
2823
+ log.error(`Adapter Exception: ${error}`);
2824
+ done(error);
2825
+ }
2826
+ }).timeout(attemptTimeout);
2827
+ });
2828
+
2829
+ const authenticationCertificatesUpdateAuthenticationCertificateBodyParam = {
2830
+ name: 'Updated name',
2831
+ start_date: '2021-12-05T00:00:00Z',
2832
+ end_date: '2022-12-10T00:00:00Z',
2833
+ usage_limit: '10',
2834
+ registered_values: [
2835
+ {
2836
+ certificate_field: 'subject.common_name',
2837
+ value: 'Updated common name value'
2838
+ }
2839
+ ]
2840
+ };
2841
+ describe('#updateAuthenticationCertificate - errors', () => {
2842
+ it('should work if integrated or standalone with mockdata', (done) => {
2843
+ try {
2844
+ a.updateAuthenticationCertificate('fakedata', authenticationCertificatesUpdateAuthenticationCertificateBodyParam, (data, error) => {
2845
+ try {
2846
+ if (stub) {
2847
+ runCommonAsserts(data, error);
2848
+ assert.equal('success', data.response);
2849
+ } else {
2850
+ runCommonAsserts(data, error);
2851
+ }
2852
+ saveMockData('AuthenticationCertificates', 'updateAuthenticationCertificate', 'default', data);
2853
+ done();
2854
+ } catch (err) {
2855
+ log.error(`Test Failure: ${err}`);
2856
+ done(err);
2857
+ }
2858
+ });
2859
+ } catch (error) {
2860
+ log.error(`Adapter Exception: ${error}`);
2861
+ done(error);
2862
+ }
2863
+ }).timeout(attemptTimeout);
2864
+ });
2865
+
2866
+ describe('#disableAuthenticationCertificate - errors', () => {
2867
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2868
+ try {
2869
+ a.disableAuthenticationCertificate('fakedata', (data, error) => {
2870
+ try {
2871
+ if (stub) {
2872
+ const displayE = 'Error 400 received on request';
2873
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2874
+ } else {
2875
+ runCommonAsserts(data, error);
2876
+ }
2877
+ saveMockData('AuthenticationCertificates', 'disableAuthenticationCertificate', 'default', data);
2878
+ done();
2879
+ } catch (err) {
2880
+ log.error(`Test Failure: ${err}`);
2881
+ done(err);
2882
+ }
2883
+ });
2884
+ } catch (error) {
2885
+ log.error(`Adapter Exception: ${error}`);
2886
+ done(error);
2887
+ }
2888
+ }).timeout(attemptTimeout);
2889
+ });
2890
+
2891
+ describe('#enableAuthenticationCertificate - errors', () => {
2892
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2893
+ try {
2894
+ a.enableAuthenticationCertificate('fakedata', (data, error) => {
2895
+ try {
2896
+ if (stub) {
2897
+ const displayE = 'Error 400 received on request';
2898
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2899
+ } else {
2900
+ runCommonAsserts(data, error);
2901
+ }
2902
+ saveMockData('AuthenticationCertificates', 'enableAuthenticationCertificate', 'default', data);
2903
+ done();
2904
+ } catch (err) {
2905
+ log.error(`Test Failure: ${err}`);
2906
+ done(err);
2907
+ }
2908
+ });
2909
+ } catch (error) {
2910
+ log.error(`Adapter Exception: ${error}`);
2911
+ done(error);
2912
+ }
2913
+ }).timeout(attemptTimeout);
2914
+ });
2915
+
2916
+ describe('#deleteAuthenticationCertificate - errors', () => {
2917
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2918
+ try {
2919
+ a.deleteAuthenticationCertificate('fakedata', (data, error) => {
2920
+ try {
2921
+ if (stub) {
2922
+ const displayE = 'Error 400 received on request';
2923
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2924
+ } else {
2925
+ runCommonAsserts(data, error);
2926
+ }
2927
+ saveMockData('AuthenticationCertificates', 'deleteAuthenticationCertificate', 'default', data);
2928
+ done();
2929
+ } catch (err) {
2930
+ log.error(`Test Failure: ${err}`);
2931
+ done(err);
2932
+ }
2933
+ });
2934
+ } catch (error) {
2935
+ log.error(`Adapter Exception: ${error}`);
2936
+ done(error);
2937
+ }
2938
+ }).timeout(attemptTimeout);
2939
+ });
2940
+
2941
+ describe('#restoreAuthenticationCertificate - errors', () => {
2942
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2943
+ try {
2944
+ a.restoreAuthenticationCertificate('fakedata', (data, error) => {
2945
+ try {
2946
+ if (stub) {
2947
+ const displayE = 'Error 400 received on request';
2948
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
2949
+ } else {
2950
+ runCommonAsserts(data, error);
2951
+ }
2952
+ saveMockData('AuthenticationCertificates', 'restoreAuthenticationCertificate', 'default', data);
2953
+ done();
2954
+ } catch (err) {
2955
+ log.error(`Test Failure: ${err}`);
2956
+ done(err);
2957
+ }
2958
+ });
2959
+ } catch (error) {
2960
+ log.error(`Adapter Exception: ${error}`);
2961
+ done(error);
2962
+ }
2963
+ }).timeout(attemptTimeout);
2964
+ });
2965
+
2966
+ describe('#listCertificateProfiles - errors', () => {
2967
+ it('should work if integrated or standalone with mockdata', (done) => {
2968
+ try {
2969
+ a.listCertificateProfiles(null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
2970
+ try {
2971
+ if (stub) {
2972
+ runCommonAsserts(data, error);
2973
+ assert.equal(20, data.response.limit);
2974
+ assert.equal(0, data.response.offset);
2975
+ assert.equal(true, data.response.pagination);
2976
+ assert.equal(false, data.response.next);
2977
+ assert.equal(1, data.response.total);
2978
+ assert.equal(true, Array.isArray(data.response.records));
2979
+ } else {
2980
+ runCommonAsserts(data, error);
2981
+ }
2982
+ saveMockData('CertificateProfiles', 'listCertificateProfiles', 'default', data);
2983
+ done();
2984
+ } catch (err) {
2985
+ log.error(`Test Failure: ${err}`);
2986
+ done(err);
2987
+ }
2988
+ });
2989
+ } catch (error) {
2990
+ log.error(`Adapter Exception: ${error}`);
2991
+ done(error);
2992
+ }
2993
+ }).timeout(attemptTimeout);
2994
+ });
2995
+
2996
+ const certificateProfilesCreateCertificateProfileBodyParam = {
2997
+ account_id: '490e13ab-0a2f-4a9d-b52b-6942ea00588f',
2998
+ certificate_template_id: 'c4e3cf2a-8c4d-4145-be5f-a81140cfbf12',
2999
+ name: 'Example certificate profile',
3000
+ body: [
3001
+ {}
3002
+ ]
3003
+ };
3004
+ describe('#createCertificateProfile - errors', () => {
3005
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3006
+ try {
3007
+ a.createCertificateProfile(certificateProfilesCreateCertificateProfileBodyParam, (data, error) => {
3008
+ try {
3009
+ if (stub) {
3010
+ const displayE = 'Error 400 received on request';
3011
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3012
+ } else {
3013
+ runCommonAsserts(data, error);
3014
+ }
3015
+ saveMockData('CertificateProfiles', 'createCertificateProfile', 'default', data);
3016
+ done();
3017
+ } catch (err) {
3018
+ log.error(`Test Failure: ${err}`);
3019
+ done(err);
3020
+ }
3021
+ });
3022
+ } catch (error) {
3023
+ log.error(`Adapter Exception: ${error}`);
3024
+ done(error);
3025
+ }
3026
+ }).timeout(attemptTimeout);
3027
+ });
3028
+
3029
+ describe('#getCertificateProfile - errors', () => {
3030
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3031
+ try {
3032
+ a.getCertificateProfile('fakedata', (data, error) => {
3033
+ try {
3034
+ if (stub) {
3035
+ const displayE = 'Error 400 received on request';
3036
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3037
+ } else {
3038
+ runCommonAsserts(data, error);
3039
+ }
3040
+ saveMockData('CertificateProfiles', 'getCertificateProfile', 'default', data);
3041
+ done();
3042
+ } catch (err) {
3043
+ log.error(`Test Failure: ${err}`);
3044
+ done(err);
3045
+ }
3046
+ });
3047
+ } catch (error) {
3048
+ log.error(`Adapter Exception: ${error}`);
3049
+ done(error);
3050
+ }
3051
+ }).timeout(attemptTimeout);
3052
+ });
3053
+
3054
+ const certificateProfilesUpdateCertificateProfileBodyParam = {
3055
+ name: 'Example certificate profile',
3056
+ body: [
3057
+ {}
3058
+ ]
3059
+ };
3060
+ describe('#updateCertificateProfile - errors', () => {
3061
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3062
+ try {
3063
+ a.updateCertificateProfile('fakedata', certificateProfilesUpdateCertificateProfileBodyParam, (data, error) => {
3064
+ try {
3065
+ if (stub) {
3066
+ const displayE = 'Error 400 received on request';
3067
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3068
+ } else {
3069
+ runCommonAsserts(data, error);
3070
+ }
3071
+ saveMockData('CertificateProfiles', 'updateCertificateProfile', 'default', data);
3072
+ done();
3073
+ } catch (err) {
3074
+ log.error(`Test Failure: ${err}`);
3075
+ done(err);
3076
+ }
3077
+ });
3078
+ } catch (error) {
3079
+ log.error(`Adapter Exception: ${error}`);
3080
+ done(error);
3081
+ }
3082
+ }).timeout(attemptTimeout);
3083
+ });
3084
+
3085
+ describe('#disableCertificateProfile - errors', () => {
3086
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3087
+ try {
3088
+ a.disableCertificateProfile('fakedata', (data, error) => {
3089
+ try {
3090
+ if (stub) {
3091
+ const displayE = 'Error 400 received on request';
3092
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3093
+ } else {
3094
+ runCommonAsserts(data, error);
3095
+ }
3096
+ saveMockData('CertificateProfiles', 'disableCertificateProfile', 'default', data);
3097
+ done();
3098
+ } catch (err) {
3099
+ log.error(`Test Failure: ${err}`);
3100
+ done(err);
3101
+ }
3102
+ });
3103
+ } catch (error) {
3104
+ log.error(`Adapter Exception: ${error}`);
3105
+ done(error);
3106
+ }
3107
+ }).timeout(attemptTimeout);
3108
+ });
3109
+
3110
+ describe('#enableCertificateProfile - errors', () => {
3111
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3112
+ try {
3113
+ a.enableCertificateProfile('fakedata', (data, error) => {
3114
+ try {
3115
+ if (stub) {
3116
+ const displayE = 'Error 400 received on request';
3117
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3118
+ } else {
3119
+ runCommonAsserts(data, error);
3120
+ }
3121
+ saveMockData('CertificateProfiles', 'enableCertificateProfile', 'default', data);
3122
+ done();
3123
+ } catch (err) {
3124
+ log.error(`Test Failure: ${err}`);
3125
+ done(err);
3126
+ }
3127
+ });
3128
+ } catch (error) {
3129
+ log.error(`Adapter Exception: ${error}`);
3130
+ done(error);
3131
+ }
3132
+ }).timeout(attemptTimeout);
3133
+ });
3134
+
3135
+ describe('#deleteCertificateProfile - errors', () => {
3136
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3137
+ try {
3138
+ a.deleteCertificateProfile('fakedata', (data, error) => {
3139
+ try {
3140
+ if (stub) {
3141
+ const displayE = 'Error 400 received on request';
3142
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3143
+ } else {
3144
+ runCommonAsserts(data, error);
3145
+ }
3146
+ saveMockData('CertificateProfiles', 'deleteCertificateProfile', 'default', data);
3147
+ done();
3148
+ } catch (err) {
3149
+ log.error(`Test Failure: ${err}`);
3150
+ done(err);
3151
+ }
3152
+ });
3153
+ } catch (error) {
3154
+ log.error(`Adapter Exception: ${error}`);
3155
+ done(error);
3156
+ }
3157
+ }).timeout(attemptTimeout);
3158
+ });
3159
+
3160
+ describe('#restoreCertificateProfile - errors', () => {
3161
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3162
+ try {
3163
+ a.restoreCertificateProfile('fakedata', (data, error) => {
3164
+ try {
3165
+ if (stub) {
3166
+ const displayE = 'Error 400 received on request';
3167
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3168
+ } else {
3169
+ runCommonAsserts(data, error);
3170
+ }
3171
+ saveMockData('CertificateProfiles', 'restoreCertificateProfile', 'default', data);
3172
+ done();
3173
+ } catch (err) {
3174
+ log.error(`Test Failure: ${err}`);
3175
+ done(err);
3176
+ }
3177
+ });
3178
+ } catch (error) {
3179
+ log.error(`Adapter Exception: ${error}`);
3180
+ done(error);
3181
+ }
3182
+ }).timeout(attemptTimeout);
3183
+ });
3184
+
3185
+ const certificateProfilesAssignCertificateProfileDivisionsBodyParam = [
3186
+ 'string'
3187
+ ];
3188
+ describe('#assignCertificateProfileDivisions - errors', () => {
3189
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3190
+ try {
3191
+ a.assignCertificateProfileDivisions('fakedata', certificateProfilesAssignCertificateProfileDivisionsBodyParam, (data, error) => {
3192
+ try {
3193
+ if (stub) {
3194
+ const displayE = 'Error 400 received on request';
3195
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3196
+ } else {
3197
+ runCommonAsserts(data, error);
3198
+ }
3199
+ saveMockData('CertificateProfiles', 'assignCertificateProfileDivisions', 'default', data);
3200
+ done();
3201
+ } catch (err) {
3202
+ log.error(`Test Failure: ${err}`);
3203
+ done(err);
3204
+ }
3205
+ });
3206
+ } catch (error) {
3207
+ log.error(`Adapter Exception: ${error}`);
3208
+ done(error);
3209
+ }
3210
+ }).timeout(attemptTimeout);
3211
+ });
3212
+
3213
+ const certificateProfilesUnassignCertificateProfileDivisionsBodyParam = [
3214
+ 'string'
3215
+ ];
3216
+ describe('#unassignCertificateProfileDivisions - errors', () => {
3217
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3218
+ try {
3219
+ a.unassignCertificateProfileDivisions('fakedata', certificateProfilesUnassignCertificateProfileDivisionsBodyParam, (data, error) => {
3220
+ try {
3221
+ if (stub) {
3222
+ const displayE = 'Error 400 received on request';
3223
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3224
+ } else {
3225
+ runCommonAsserts(data, error);
3226
+ }
3227
+ saveMockData('CertificateProfiles', 'unassignCertificateProfileDivisions', 'default', data);
3228
+ done();
3229
+ } catch (err) {
3230
+ log.error(`Test Failure: ${err}`);
3231
+ done(err);
3232
+ }
3233
+ });
3234
+ } catch (error) {
3235
+ log.error(`Adapter Exception: ${error}`);
3236
+ done(error);
3237
+ }
3238
+ }).timeout(attemptTimeout);
3239
+ });
3240
+
3241
+ describe('#getRequestStatus - errors', () => {
3242
+ it('should work if integrated or standalone with mockdata', (done) => {
3243
+ try {
3244
+ a.getRequestStatus('fakedata', (data, error) => {
3245
+ try {
3246
+ if (stub) {
3247
+ runCommonAsserts(data, error);
3248
+ assert.equal('cad89ac2-fe65-4b11-bf28-3b84a9c59bdd', data.response.certificate_request_id);
3249
+ assert.equal('PENDING_APPROVAL', data.response.status);
3250
+ assert.equal('51967282-23d3-429b-b4c6-a52e2c2dd389', data.response.certificate_id);
3251
+ } else {
3252
+ runCommonAsserts(data, error);
3253
+ }
3254
+ saveMockData('CertificateRequests', 'getRequestStatus', 'default', data);
3255
+ done();
3256
+ } catch (err) {
3257
+ log.error(`Test Failure: ${err}`);
3258
+ done(err);
3259
+ }
3260
+ });
3261
+ } catch (error) {
3262
+ log.error(`Adapter Exception: ${error}`);
3263
+ done(error);
3264
+ }
3265
+ }).timeout(attemptTimeout);
3266
+ });
3267
+
3268
+ describe('#listCertificateTemplates - errors', () => {
3269
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3270
+ try {
3271
+ a.listCertificateTemplates(null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
3272
+ try {
3273
+ if (stub) {
3274
+ const displayE = 'Error 400 received on request';
3275
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3276
+ } else {
3277
+ runCommonAsserts(data, error);
3278
+ }
3279
+ saveMockData('CertificateTemplates', 'listCertificateTemplates', 'default', data);
3280
+ done();
3281
+ } catch (err) {
3282
+ log.error(`Test Failure: ${err}`);
3283
+ done(err);
3284
+ }
3285
+ });
3286
+ } catch (error) {
3287
+ log.error(`Adapter Exception: ${error}`);
3288
+ done(error);
3289
+ }
3290
+ }).timeout(attemptTimeout);
3291
+ });
3292
+
3293
+ const certificateTemplatesCreateCertificateTemplateBodyParam = {
3294
+ name: 'Example template',
3295
+ body: {},
3296
+ accounts: [
3297
+ 'string'
3298
+ ]
3299
+ };
3300
+ describe('#createCertificateTemplate - errors', () => {
3301
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3302
+ try {
3303
+ a.createCertificateTemplate(certificateTemplatesCreateCertificateTemplateBodyParam, (data, error) => {
3304
+ try {
3305
+ if (stub) {
3306
+ const displayE = 'Error 400 received on request';
3307
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3308
+ } else {
3309
+ runCommonAsserts(data, error);
3310
+ }
3311
+ saveMockData('CertificateTemplates', 'createCertificateTemplate', 'default', data);
3312
+ done();
3313
+ } catch (err) {
3314
+ log.error(`Test Failure: ${err}`);
3315
+ done(err);
3316
+ }
3317
+ });
3318
+ } catch (error) {
3319
+ log.error(`Adapter Exception: ${error}`);
3320
+ done(error);
3321
+ }
3322
+ }).timeout(attemptTimeout);
3323
+ });
3324
+
3325
+ describe('#getCertificateTemplate - errors', () => {
3326
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3327
+ try {
3328
+ a.getCertificateTemplate('fakedata', (data, error) => {
3329
+ try {
3330
+ if (stub) {
3331
+ const displayE = 'Error 400 received on request';
3332
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3333
+ } else {
3334
+ runCommonAsserts(data, error);
3335
+ }
3336
+ saveMockData('CertificateTemplates', 'getCertificateTemplate', 'default', data);
3337
+ done();
3338
+ } catch (err) {
3339
+ log.error(`Test Failure: ${err}`);
3340
+ done(err);
3341
+ }
3342
+ });
3343
+ } catch (error) {
3344
+ log.error(`Adapter Exception: ${error}`);
3345
+ done(error);
3346
+ }
3347
+ }).timeout(attemptTimeout);
3348
+ });
3349
+
3350
+ const certificateTemplatesUpdateCertificateTemplateBodyParam = {
3351
+ name: 'Example template',
3352
+ body: {},
3353
+ accounts: [
3354
+ 'string'
3355
+ ]
3356
+ };
3357
+ describe('#updateCertificateTemplate - errors', () => {
3358
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3359
+ try {
3360
+ a.updateCertificateTemplate('fakedata', certificateTemplatesUpdateCertificateTemplateBodyParam, (data, error) => {
3361
+ try {
3362
+ if (stub) {
3363
+ const displayE = 'Error 400 received on request';
3364
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3365
+ } else {
3366
+ runCommonAsserts(data, error);
3367
+ }
3368
+ saveMockData('CertificateTemplates', 'updateCertificateTemplate', 'default', data);
3369
+ done();
3370
+ } catch (err) {
3371
+ log.error(`Test Failure: ${err}`);
3372
+ done(err);
3373
+ }
3374
+ });
3375
+ } catch (error) {
3376
+ log.error(`Adapter Exception: ${error}`);
3377
+ done(error);
3378
+ }
3379
+ }).timeout(attemptTimeout);
3380
+ });
3381
+
3382
+ const certificateTemplatesClonecertificatetemplateBodyParam = {
3383
+ name: 'Example template'
3384
+ };
3385
+ describe('#clonecertificatetemplate - errors', () => {
3386
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3387
+ try {
3388
+ a.clonecertificatetemplate('fakedata', certificateTemplatesClonecertificatetemplateBodyParam, (data, error) => {
3389
+ try {
3390
+ if (stub) {
3391
+ const displayE = 'Error 400 received on request';
3392
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3393
+ } else {
3394
+ runCommonAsserts(data, error);
3395
+ }
3396
+ saveMockData('CertificateTemplates', 'clonecertificatetemplate', 'default', data);
3397
+ done();
3398
+ } catch (err) {
3399
+ log.error(`Test Failure: ${err}`);
3400
+ done(err);
3401
+ }
3402
+ });
3403
+ } catch (error) {
3404
+ log.error(`Adapter Exception: ${error}`);
3405
+ done(error);
3406
+ }
3407
+ }).timeout(attemptTimeout);
3408
+ });
3409
+
3410
+ describe('#disableCertificateTemplate - errors', () => {
3411
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3412
+ try {
3413
+ a.disableCertificateTemplate('fakedata', (data, error) => {
3414
+ try {
3415
+ if (stub) {
3416
+ const displayE = 'Error 400 received on request';
3417
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3418
+ } else {
3419
+ runCommonAsserts(data, error);
3420
+ }
3421
+ saveMockData('CertificateTemplates', 'disableCertificateTemplate', 'default', data);
3422
+ done();
3423
+ } catch (err) {
3424
+ log.error(`Test Failure: ${err}`);
3425
+ done(err);
3426
+ }
3427
+ });
3428
+ } catch (error) {
3429
+ log.error(`Adapter Exception: ${error}`);
3430
+ done(error);
3431
+ }
3432
+ }).timeout(attemptTimeout);
3433
+ });
3434
+
3435
+ describe('#enableCertificateTemplate - errors', () => {
3436
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3437
+ try {
3438
+ a.enableCertificateTemplate('fakedata', (data, error) => {
3439
+ try {
3440
+ if (stub) {
3441
+ const displayE = 'Error 400 received on request';
3442
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3443
+ } else {
3444
+ runCommonAsserts(data, error);
3445
+ }
3446
+ saveMockData('CertificateTemplates', 'enableCertificateTemplate', 'default', data);
3447
+ done();
3448
+ } catch (err) {
3449
+ log.error(`Test Failure: ${err}`);
3450
+ done(err);
3451
+ }
3452
+ });
3453
+ } catch (error) {
3454
+ log.error(`Adapter Exception: ${error}`);
3455
+ done(error);
3456
+ }
3457
+ }).timeout(attemptTimeout);
3458
+ });
3459
+
3460
+ describe('#deleteCertificateTemplate - errors', () => {
3461
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3462
+ try {
3463
+ a.deleteCertificateTemplate('fakedata', (data, error) => {
3464
+ try {
3465
+ if (stub) {
3466
+ const displayE = 'Error 400 received on request';
3467
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3468
+ } else {
3469
+ runCommonAsserts(data, error);
3470
+ }
3471
+ saveMockData('CertificateTemplates', 'deleteCertificateTemplate', 'default', data);
3472
+ done();
3473
+ } catch (err) {
3474
+ log.error(`Test Failure: ${err}`);
3475
+ done(err);
3476
+ }
3477
+ });
3478
+ } catch (error) {
3479
+ log.error(`Adapter Exception: ${error}`);
3480
+ done(error);
3481
+ }
3482
+ }).timeout(attemptTimeout);
3483
+ });
3484
+
3485
+ describe('#restoreCertificateTemplate - errors', () => {
3486
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3487
+ try {
3488
+ a.restoreCertificateTemplate('fakedata', (data, error) => {
3489
+ try {
3490
+ if (stub) {
3491
+ const displayE = 'Error 400 received on request';
3492
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3493
+ } else {
3494
+ runCommonAsserts(data, error);
3495
+ }
3496
+ saveMockData('CertificateTemplates', 'restoreCertificateTemplate', 'default', data);
3497
+ done();
3498
+ } catch (err) {
3499
+ log.error(`Test Failure: ${err}`);
3500
+ done(err);
3501
+ }
3502
+ });
3503
+ } catch (error) {
3504
+ log.error(`Adapter Exception: ${error}`);
3505
+ done(error);
3506
+ }
3507
+ }).timeout(attemptTimeout);
3508
+ });
3509
+
3510
+ const devicesCreateDeviceBodyParam = {
3511
+ division_id: 'fd5faa1e-623a-47a9-831b-b9397c33395f',
3512
+ device_identifier: 'Device name',
3513
+ device_profile_id: 'a81a431a-be7b-4f2e-8afd-b2778491511f'
3514
+ };
3515
+ describe('#createDevice - errors', () => {
3516
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3517
+ try {
3518
+ a.createDevice(devicesCreateDeviceBodyParam, (data, error) => {
3519
+ try {
3520
+ if (stub) {
3521
+ const displayE = 'Error 400 received on request';
3522
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3523
+ } else {
3524
+ runCommonAsserts(data, error);
3525
+ }
3526
+ saveMockData('Devices', 'createDevice', 'default', data);
3527
+ done();
3528
+ } catch (err) {
3529
+ log.error(`Test Failure: ${err}`);
3530
+ done(err);
3531
+ }
3532
+ });
3533
+ } catch (error) {
3534
+ log.error(`Adapter Exception: ${error}`);
3535
+ done(error);
3536
+ }
3537
+ }).timeout(attemptTimeout);
3538
+ });
3539
+
3540
+ describe('#getDeviceList - errors', () => {
3541
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3542
+ try {
3543
+ a.getDeviceList(null, null, null, null, null, null, null, null, null, null, (data, error) => {
3544
+ try {
3545
+ if (stub) {
3546
+ const displayE = 'Error 400 received on request';
3547
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3548
+ } else {
3549
+ runCommonAsserts(data, error);
3550
+ }
3551
+ saveMockData('Devices', 'getDeviceList', 'default', data);
3552
+ done();
3553
+ } catch (err) {
3554
+ log.error(`Test Failure: ${err}`);
3555
+ done(err);
3556
+ }
3557
+ });
3558
+ } catch (error) {
3559
+ log.error(`Adapter Exception: ${error}`);
3560
+ done(error);
3561
+ }
3562
+ }).timeout(attemptTimeout);
3563
+ });
3564
+
3565
+ describe('#getDeviceDetails - errors', () => {
3566
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3567
+ try {
3568
+ a.getDeviceDetails('fakedata', 'fakedata', (data, error) => {
3569
+ try {
3570
+ if (stub) {
3571
+ const displayE = 'Error 400 received on request';
3572
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3573
+ } else {
3574
+ runCommonAsserts(data, error);
3575
+ }
3576
+ saveMockData('Devices', 'getDeviceDetails', 'default', data);
3577
+ done();
3578
+ } catch (err) {
3579
+ log.error(`Test Failure: ${err}`);
3580
+ done(err);
3581
+ }
3582
+ });
3583
+ } catch (error) {
3584
+ log.error(`Adapter Exception: ${error}`);
3585
+ done(error);
3586
+ }
3587
+ }).timeout(attemptTimeout);
3588
+ });
3589
+
3590
+ const devicesUpdateDeviceBodyParam = {
3591
+ device_identifier: 'Device name',
3592
+ fields: [
3593
+ {
3594
+ id: '123c456e-789c-1e23-4567-ee90f39458fb',
3595
+ value: 'Field value'
3596
+ }
3597
+ ],
3598
+ device_api_allow_read: true,
3599
+ device_api_allow_write: true,
3600
+ device_api_allow_renew_certificate: true
3601
+ };
3602
+ describe('#updateDevice - errors', () => {
3603
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3604
+ try {
3605
+ a.updateDevice('fakedata', 'fakedata', devicesUpdateDeviceBodyParam, (data, error) => {
3606
+ try {
3607
+ if (stub) {
3608
+ const displayE = 'Error 400 received on request';
3609
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3610
+ } else {
3611
+ runCommonAsserts(data, error);
3612
+ }
3613
+ saveMockData('Devices', 'updateDevice', 'default', data);
3614
+ done();
3615
+ } catch (err) {
3616
+ log.error(`Test Failure: ${err}`);
3617
+ done(err);
3618
+ }
3619
+ });
3620
+ } catch (error) {
3621
+ log.error(`Adapter Exception: ${error}`);
3622
+ done(error);
3623
+ }
3624
+ }).timeout(attemptTimeout);
3625
+ });
3626
+
3627
+ describe('#archiveDevice - errors', () => {
3628
+ it('should work if integrated or standalone with mockdata', (done) => {
3629
+ try {
3630
+ a.archiveDevice('fakedata', 'fakedata', (data, error) => {
3631
+ try {
3632
+ if (stub) {
3633
+ runCommonAsserts(data, error);
3634
+ assert.equal('success', data.response);
3635
+ } else {
3636
+ runCommonAsserts(data, error);
3637
+ }
3638
+ saveMockData('Devices', 'archiveDevice', 'default', data);
3639
+ done();
3640
+ } catch (err) {
3641
+ log.error(`Test Failure: ${err}`);
3642
+ done(err);
3643
+ }
3644
+ });
3645
+ } catch (error) {
3646
+ log.error(`Adapter Exception: ${error}`);
3647
+ done(error);
3648
+ }
3649
+ }).timeout(attemptTimeout);
3650
+ });
3651
+
3652
+ describe('#enableDevice - errors', () => {
3653
+ it('should work if integrated or standalone with mockdata', (done) => {
3654
+ try {
3655
+ a.enableDevice('fakedata', 'fakedata', (data, error) => {
3656
+ try {
3657
+ if (stub) {
3658
+ runCommonAsserts(data, error);
3659
+ assert.equal('success', data.response);
3660
+ } else {
3661
+ runCommonAsserts(data, error);
3662
+ }
3663
+ saveMockData('Devices', 'enableDevice', 'default', data);
3664
+ done();
3665
+ } catch (err) {
3666
+ log.error(`Test Failure: ${err}`);
3667
+ done(err);
3668
+ }
3669
+ });
3670
+ } catch (error) {
3671
+ log.error(`Adapter Exception: ${error}`);
3672
+ done(error);
3673
+ }
3674
+ }).timeout(attemptTimeout);
3675
+ });
3676
+
3677
+ describe('#disableDevice - errors', () => {
3678
+ it('should work if integrated or standalone with mockdata', (done) => {
3679
+ try {
3680
+ a.disableDevice('fakedata', 'fakedata', (data, error) => {
3681
+ try {
3682
+ if (stub) {
3683
+ runCommonAsserts(data, error);
3684
+ assert.equal('success', data.response);
3685
+ } else {
3686
+ runCommonAsserts(data, error);
3687
+ }
3688
+ saveMockData('Devices', 'disableDevice', 'default', data);
3689
+ done();
3690
+ } catch (err) {
3691
+ log.error(`Test Failure: ${err}`);
3692
+ done(err);
3693
+ }
3694
+ });
3695
+ } catch (error) {
3696
+ log.error(`Adapter Exception: ${error}`);
3697
+ done(error);
3698
+ }
3699
+ }).timeout(attemptTimeout);
3700
+ });
3701
+
3702
+ describe('#restoreDevice - errors', () => {
3703
+ it('should work if integrated or standalone with mockdata', (done) => {
3704
+ try {
3705
+ a.restoreDevice('fakedata', 'fakedata', (data, error) => {
3706
+ try {
3707
+ if (stub) {
3708
+ runCommonAsserts(data, error);
3709
+ assert.equal('success', data.response);
3710
+ } else {
3711
+ runCommonAsserts(data, error);
3712
+ }
3713
+ saveMockData('Devices', 'restoreDevice', 'default', data);
3714
+ done();
3715
+ } catch (err) {
3716
+ log.error(`Test Failure: ${err}`);
3717
+ done(err);
3718
+ }
3719
+ });
3720
+ } catch (error) {
3721
+ log.error(`Adapter Exception: ${error}`);
3722
+ done(error);
3723
+ }
3724
+ }).timeout(attemptTimeout);
3725
+ });
3726
+
3727
+ const devicesV2CreateDeviceV2BodyParam = {
3728
+ division_id: 'fd5faa1e-623a-47a9-831b-b9397c33395f',
3729
+ device_identifier: 'Device name',
3730
+ device_profile_id: 'a81a431a-be7b-4f2e-8afd-b2778491511f'
3731
+ };
3732
+ describe('#createDeviceV2 - errors', () => {
3733
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3734
+ try {
3735
+ a.createDeviceV2(devicesV2CreateDeviceV2BodyParam, (data, error) => {
3736
+ try {
3737
+ if (stub) {
3738
+ const displayE = 'Error 400 received on request';
3739
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3740
+ } else {
3741
+ runCommonAsserts(data, error);
3742
+ }
3743
+ saveMockData('DevicesV2', 'createDeviceV2', 'default', data);
3744
+ done();
3745
+ } catch (err) {
3746
+ log.error(`Test Failure: ${err}`);
3747
+ done(err);
3748
+ }
3749
+ });
3750
+ } catch (error) {
3751
+ log.error(`Adapter Exception: ${error}`);
3752
+ done(error);
3753
+ }
3754
+ }).timeout(attemptTimeout);
3755
+ });
3756
+
3757
+ describe('#getDeviceListV2 - errors', () => {
3758
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3759
+ try {
3760
+ a.getDeviceListV2(null, null, null, null, null, null, null, null, null, null, (data, error) => {
3761
+ try {
3762
+ if (stub) {
3763
+ const displayE = 'Error 400 received on request';
3764
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3765
+ } else {
3766
+ runCommonAsserts(data, error);
3767
+ }
3768
+ saveMockData('DevicesV2', 'getDeviceListV2', 'default', data);
3769
+ done();
3770
+ } catch (err) {
3771
+ log.error(`Test Failure: ${err}`);
3772
+ done(err);
3773
+ }
3774
+ });
3775
+ } catch (error) {
3776
+ log.error(`Adapter Exception: ${error}`);
3777
+ done(error);
3778
+ }
3779
+ }).timeout(attemptTimeout);
3780
+ });
3781
+
3782
+ describe('#getDeviceDetailsV2 - errors', () => {
3783
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3784
+ try {
3785
+ a.getDeviceDetailsV2('fakedata', (data, error) => {
3786
+ try {
3787
+ if (stub) {
3788
+ const displayE = 'Error 400 received on request';
3789
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3790
+ } else {
3791
+ runCommonAsserts(data, error);
3792
+ }
3793
+ saveMockData('DevicesV2', 'getDeviceDetailsV2', 'default', data);
3794
+ done();
3795
+ } catch (err) {
3796
+ log.error(`Test Failure: ${err}`);
3797
+ done(err);
3798
+ }
3799
+ });
3800
+ } catch (error) {
3801
+ log.error(`Adapter Exception: ${error}`);
3802
+ done(error);
3803
+ }
3804
+ }).timeout(attemptTimeout);
3805
+ });
3806
+
3807
+ const devicesV2UpdateDeviceV2BodyParam = {
3808
+ device_identifier: 'Device name',
3809
+ fields: [
3810
+ {
3811
+ id: '123c456e-789c-1e23-4567-ee90f39458fb',
3812
+ value: 'Field value'
3813
+ }
3814
+ ],
3815
+ device_api_allow_read: true,
3816
+ device_api_allow_write: true,
3817
+ device_api_allow_renew_certificate: true
3818
+ };
3819
+ describe('#updateDeviceV2 - errors', () => {
3820
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3821
+ try {
3822
+ a.updateDeviceV2('fakedata', devicesV2UpdateDeviceV2BodyParam, (data, error) => {
3823
+ try {
3824
+ if (stub) {
3825
+ const displayE = 'Error 400 received on request';
3826
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3827
+ } else {
3828
+ runCommonAsserts(data, error);
3829
+ }
3830
+ saveMockData('DevicesV2', 'updateDeviceV2', 'default', data);
3831
+ done();
3832
+ } catch (err) {
3833
+ log.error(`Test Failure: ${err}`);
3834
+ done(err);
3835
+ }
3836
+ });
3837
+ } catch (error) {
3838
+ log.error(`Adapter Exception: ${error}`);
3839
+ done(error);
3840
+ }
3841
+ }).timeout(attemptTimeout);
3842
+ });
3843
+
3844
+ describe('#archiveDeviceV2 - errors', () => {
3845
+ it('should work if integrated or standalone with mockdata', (done) => {
3846
+ try {
3847
+ a.archiveDeviceV2('fakedata', (data, error) => {
3848
+ try {
3849
+ if (stub) {
3850
+ runCommonAsserts(data, error);
3851
+ assert.equal('success', data.response);
3852
+ } else {
3853
+ runCommonAsserts(data, error);
3854
+ }
3855
+ saveMockData('DevicesV2', 'archiveDeviceV2', 'default', data);
3856
+ done();
3857
+ } catch (err) {
3858
+ log.error(`Test Failure: ${err}`);
3859
+ done(err);
3860
+ }
3861
+ });
3862
+ } catch (error) {
3863
+ log.error(`Adapter Exception: ${error}`);
3864
+ done(error);
3865
+ }
3866
+ }).timeout(attemptTimeout);
3867
+ });
3868
+
3869
+ describe('#enableDeviceV2 - errors', () => {
3870
+ it('should work if integrated or standalone with mockdata', (done) => {
3871
+ try {
3872
+ a.enableDeviceV2('fakedata', (data, error) => {
3873
+ try {
3874
+ if (stub) {
3875
+ runCommonAsserts(data, error);
3876
+ assert.equal('success', data.response);
3877
+ } else {
3878
+ runCommonAsserts(data, error);
3879
+ }
3880
+ saveMockData('DevicesV2', 'enableDeviceV2', 'default', data);
3881
+ done();
3882
+ } catch (err) {
3883
+ log.error(`Test Failure: ${err}`);
3884
+ done(err);
3885
+ }
3886
+ });
3887
+ } catch (error) {
3888
+ log.error(`Adapter Exception: ${error}`);
3889
+ done(error);
3890
+ }
3891
+ }).timeout(attemptTimeout);
3892
+ });
3893
+
3894
+ describe('#disableDeviceV2 - errors', () => {
3895
+ it('should work if integrated or standalone with mockdata', (done) => {
3896
+ try {
3897
+ a.disableDeviceV2('fakedata', (data, error) => {
3898
+ try {
3899
+ if (stub) {
3900
+ runCommonAsserts(data, error);
3901
+ assert.equal('success', data.response);
3902
+ } else {
3903
+ runCommonAsserts(data, error);
3904
+ }
3905
+ saveMockData('DevicesV2', 'disableDeviceV2', 'default', data);
3906
+ done();
3907
+ } catch (err) {
3908
+ log.error(`Test Failure: ${err}`);
3909
+ done(err);
3910
+ }
3911
+ });
3912
+ } catch (error) {
3913
+ log.error(`Adapter Exception: ${error}`);
3914
+ done(error);
3915
+ }
3916
+ }).timeout(attemptTimeout);
3917
+ });
3918
+
3919
+ describe('#restoreDeviceV2 - errors', () => {
3920
+ it('should work if integrated or standalone with mockdata', (done) => {
3921
+ try {
3922
+ a.restoreDeviceV2('fakedata', (data, error) => {
3923
+ try {
3924
+ if (stub) {
3925
+ runCommonAsserts(data, error);
3926
+ assert.equal('success', data.response);
3927
+ } else {
3928
+ runCommonAsserts(data, error);
3929
+ }
3930
+ saveMockData('DevicesV2', 'restoreDeviceV2', 'default', data);
3931
+ done();
3932
+ } catch (err) {
3933
+ log.error(`Test Failure: ${err}`);
3934
+ done(err);
3935
+ }
3936
+ });
3937
+ } catch (error) {
3938
+ log.error(`Adapter Exception: ${error}`);
3939
+ done(error);
3940
+ }
3941
+ }).timeout(attemptTimeout);
3942
+ });
3943
+
3944
+ const devicesV2RenewDeviceCertificateV2BodyParam = {
3945
+ csr: 'string'
3946
+ };
3947
+ describe('#renewDeviceCertificateV2 - errors', () => {
3948
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3949
+ try {
3950
+ a.renewDeviceCertificateV2('fakedata', devicesV2RenewDeviceCertificateV2BodyParam, (data, error) => {
3951
+ try {
3952
+ if (stub) {
3953
+ const displayE = 'Error 400 received on request';
3954
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3955
+ } else {
3956
+ runCommonAsserts(data, error);
3957
+ }
3958
+ saveMockData('DevicesV2', 'renewDeviceCertificateV2', 'default', data);
3959
+ done();
3960
+ } catch (err) {
3961
+ log.error(`Test Failure: ${err}`);
3962
+ done(err);
3963
+ }
3964
+ });
3965
+ } catch (error) {
3966
+ log.error(`Adapter Exception: ${error}`);
3967
+ done(error);
3968
+ }
3969
+ }).timeout(attemptTimeout);
3970
+ });
3971
+
3972
+ describe('#listDivisions - errors', () => {
3973
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
3974
+ try {
3975
+ a.listDivisions(null, null, null, null, null, null, null, (data, error) => {
3976
+ try {
3977
+ if (stub) {
3978
+ const displayE = 'Error 400 received on request';
3979
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
3980
+ } else {
3981
+ runCommonAsserts(data, error);
3982
+ }
3983
+ saveMockData('Divisions', 'listDivisions', 'default', data);
3984
+ done();
3985
+ } catch (err) {
3986
+ log.error(`Test Failure: ${err}`);
3987
+ done(err);
3988
+ }
3989
+ });
3990
+ } catch (error) {
3991
+ log.error(`Adapter Exception: ${error}`);
3992
+ done(error);
3993
+ }
3994
+ }).timeout(attemptTimeout);
3995
+ });
3996
+
3997
+ const divisionsCreateDivisionBodyParam = {
3998
+ name: 'Example division name',
3999
+ account_id: 'f92834ce-cdea-1584-b154-193bb198345e'
4000
+ };
4001
+ describe('#createDivision - errors', () => {
4002
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4003
+ try {
4004
+ a.createDivision(divisionsCreateDivisionBodyParam, (data, error) => {
4005
+ try {
4006
+ if (stub) {
4007
+ const displayE = 'Error 400 received on request';
4008
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4009
+ } else {
4010
+ runCommonAsserts(data, error);
4011
+ }
4012
+ saveMockData('Divisions', 'createDivision', 'default', data);
4013
+ done();
4014
+ } catch (err) {
4015
+ log.error(`Test Failure: ${err}`);
4016
+ done(err);
4017
+ }
4018
+ });
4019
+ } catch (error) {
4020
+ log.error(`Adapter Exception: ${error}`);
4021
+ done(error);
4022
+ }
4023
+ }).timeout(attemptTimeout);
4024
+ });
4025
+
4026
+ describe('#getDivision - errors', () => {
4027
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4028
+ try {
4029
+ a.getDivision('fakedata', (data, error) => {
4030
+ try {
4031
+ if (stub) {
4032
+ const displayE = 'Error 400 received on request';
4033
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4034
+ } else {
4035
+ runCommonAsserts(data, error);
4036
+ }
4037
+ saveMockData('Divisions', 'getDivision', 'default', data);
4038
+ done();
4039
+ } catch (err) {
4040
+ log.error(`Test Failure: ${err}`);
4041
+ done(err);
4042
+ }
4043
+ });
4044
+ } catch (error) {
4045
+ log.error(`Adapter Exception: ${error}`);
4046
+ done(error);
4047
+ }
4048
+ }).timeout(attemptTimeout);
4049
+ });
4050
+
4051
+ const divisionsUpdateDivisionBodyParam = {
4052
+ name: 'Example division name'
4053
+ };
4054
+ describe('#updateDivision - errors', () => {
4055
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4056
+ try {
4057
+ a.updateDivision('fakedata', divisionsUpdateDivisionBodyParam, (data, error) => {
4058
+ try {
4059
+ if (stub) {
4060
+ const displayE = 'Error 400 received on request';
4061
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4062
+ } else {
4063
+ runCommonAsserts(data, error);
4064
+ }
4065
+ saveMockData('Divisions', 'updateDivision', 'default', data);
4066
+ done();
4067
+ } catch (err) {
4068
+ log.error(`Test Failure: ${err}`);
4069
+ done(err);
4070
+ }
4071
+ });
4072
+ } catch (error) {
4073
+ log.error(`Adapter Exception: ${error}`);
4074
+ done(error);
4075
+ }
4076
+ }).timeout(attemptTimeout);
4077
+ });
4078
+
4079
+ describe('#disableDivision - errors', () => {
4080
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4081
+ try {
4082
+ a.disableDivision('fakedata', (data, error) => {
4083
+ try {
4084
+ if (stub) {
4085
+ const displayE = 'Error 400 received on request';
4086
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4087
+ } else {
4088
+ runCommonAsserts(data, error);
4089
+ }
4090
+ saveMockData('Divisions', 'disableDivision', 'default', data);
4091
+ done();
4092
+ } catch (err) {
4093
+ log.error(`Test Failure: ${err}`);
4094
+ done(err);
4095
+ }
4096
+ });
4097
+ } catch (error) {
4098
+ log.error(`Adapter Exception: ${error}`);
4099
+ done(error);
4100
+ }
4101
+ }).timeout(attemptTimeout);
4102
+ });
4103
+
4104
+ describe('#enableDivision - errors', () => {
4105
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4106
+ try {
4107
+ a.enableDivision('fakedata', (data, error) => {
4108
+ try {
4109
+ if (stub) {
4110
+ const displayE = 'Error 400 received on request';
4111
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4112
+ } else {
4113
+ runCommonAsserts(data, error);
4114
+ }
4115
+ saveMockData('Divisions', 'enableDivision', 'default', data);
4116
+ done();
4117
+ } catch (err) {
4118
+ log.error(`Test Failure: ${err}`);
4119
+ done(err);
4120
+ }
4121
+ });
4122
+ } catch (error) {
4123
+ log.error(`Adapter Exception: ${error}`);
4124
+ done(error);
4125
+ }
4126
+ }).timeout(attemptTimeout);
4127
+ });
4128
+
4129
+ describe('#deleteDivision - errors', () => {
4130
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4131
+ try {
4132
+ a.deleteDivision('fakedata', (data, error) => {
4133
+ try {
4134
+ if (stub) {
4135
+ const displayE = 'Error 400 received on request';
4136
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4137
+ } else {
4138
+ runCommonAsserts(data, error);
4139
+ }
4140
+ saveMockData('Divisions', 'deleteDivision', 'default', data);
4141
+ done();
4142
+ } catch (err) {
4143
+ log.error(`Test Failure: ${err}`);
4144
+ done(err);
4145
+ }
4146
+ });
4147
+ } catch (error) {
4148
+ log.error(`Adapter Exception: ${error}`);
4149
+ done(error);
4150
+ }
4151
+ }).timeout(attemptTimeout);
4152
+ });
4153
+
4154
+ describe('#restoreDivision - errors', () => {
4155
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4156
+ try {
4157
+ a.restoreDivision('fakedata', (data, error) => {
4158
+ try {
4159
+ if (stub) {
4160
+ const displayE = 'Error 400 received on request';
4161
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4162
+ } else {
4163
+ runCommonAsserts(data, error);
4164
+ }
4165
+ saveMockData('Divisions', 'restoreDivision', 'default', data);
4166
+ done();
4167
+ } catch (err) {
4168
+ log.error(`Test Failure: ${err}`);
4169
+ done(err);
4170
+ }
4171
+ });
4172
+ } catch (error) {
4173
+ log.error(`Adapter Exception: ${error}`);
4174
+ done(error);
4175
+ }
4176
+ }).timeout(attemptTimeout);
4177
+ });
4178
+
4179
+ const divisionsAssignDivisionUsersBodyParam = [
4180
+ 'string'
4181
+ ];
4182
+ describe('#assignDivisionUsers - errors', () => {
4183
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4184
+ try {
4185
+ a.assignDivisionUsers('fakedata', divisionsAssignDivisionUsersBodyParam, (data, error) => {
4186
+ try {
4187
+ if (stub) {
4188
+ const displayE = 'Error 400 received on request';
4189
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4190
+ } else {
4191
+ runCommonAsserts(data, error);
4192
+ }
4193
+ saveMockData('Divisions', 'assignDivisionUsers', 'default', data);
4194
+ done();
4195
+ } catch (err) {
4196
+ log.error(`Test Failure: ${err}`);
4197
+ done(err);
4198
+ }
4199
+ });
4200
+ } catch (error) {
4201
+ log.error(`Adapter Exception: ${error}`);
4202
+ done(error);
4203
+ }
4204
+ }).timeout(attemptTimeout);
4205
+ });
4206
+
4207
+ describe('#listDivisionUsers - errors', () => {
4208
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4209
+ try {
4210
+ a.listDivisionUsers('fakedata', null, null, (data, error) => {
4211
+ try {
4212
+ if (stub) {
4213
+ const displayE = 'Error 400 received on request';
4214
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4215
+ } else {
4216
+ runCommonAsserts(data, error);
4217
+ }
4218
+ saveMockData('Divisions', 'listDivisionUsers', 'default', data);
4219
+ done();
4220
+ } catch (err) {
4221
+ log.error(`Test Failure: ${err}`);
4222
+ done(err);
4223
+ }
4224
+ });
4225
+ } catch (error) {
4226
+ log.error(`Adapter Exception: ${error}`);
4227
+ done(error);
4228
+ }
4229
+ }).timeout(attemptTimeout);
4230
+ });
4231
+
4232
+ const divisionsRemoveDivisionUsersBodyParam = [
4233
+ 'string'
4234
+ ];
4235
+ describe('#removeDivisionUsers - errors', () => {
4236
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4237
+ try {
4238
+ a.removeDivisionUsers('fakedata', divisionsRemoveDivisionUsersBodyParam, (data, error) => {
4239
+ try {
4240
+ if (stub) {
4241
+ const displayE = 'Error 400 received on request';
4242
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4243
+ } else {
4244
+ runCommonAsserts(data, error);
4245
+ }
4246
+ saveMockData('Divisions', 'removeDivisionUsers', 'default', data);
4247
+ done();
4248
+ } catch (err) {
4249
+ log.error(`Test Failure: ${err}`);
4250
+ done(err);
4251
+ }
4252
+ });
4253
+ } catch (error) {
4254
+ log.error(`Adapter Exception: ${error}`);
4255
+ done(error);
4256
+ }
4257
+ }).timeout(attemptTimeout);
4258
+ });
4259
+
4260
+ const divisionsAssignICAstodivisionBodyParam = [
4261
+ 'string'
4262
+ ];
4263
+ describe('#assignICAstodivision - errors', () => {
4264
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4265
+ try {
4266
+ a.assignICAstodivision('fakedata', divisionsAssignICAstodivisionBodyParam, (data, error) => {
4267
+ try {
4268
+ if (stub) {
4269
+ const displayE = 'Error 400 received on request';
4270
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4271
+ } else {
4272
+ runCommonAsserts(data, error);
4273
+ }
4274
+ saveMockData('Divisions', 'assignICAstodivision', 'default', data);
4275
+ done();
4276
+ } catch (err) {
4277
+ log.error(`Test Failure: ${err}`);
4278
+ done(err);
4279
+ }
4280
+ });
4281
+ } catch (error) {
4282
+ log.error(`Adapter Exception: ${error}`);
4283
+ done(error);
4284
+ }
4285
+ }).timeout(attemptTimeout);
4286
+ });
4287
+
4288
+ const divisionsRemoveICAsfromdivisionBodyParam = [
4289
+ 'string'
4290
+ ];
4291
+ describe('#removeICAsfromdivision - errors', () => {
4292
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4293
+ try {
4294
+ a.removeICAsfromdivision('fakedata', divisionsRemoveICAsfromdivisionBodyParam, (data, error) => {
4295
+ try {
4296
+ if (stub) {
4297
+ const displayE = 'Error 400 received on request';
4298
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4299
+ } else {
4300
+ runCommonAsserts(data, error);
4301
+ }
4302
+ saveMockData('Divisions', 'removeICAsfromdivision', 'default', data);
4303
+ done();
4304
+ } catch (err) {
4305
+ log.error(`Test Failure: ${err}`);
4306
+ done(err);
4307
+ }
4308
+ });
4309
+ } catch (error) {
4310
+ log.error(`Adapter Exception: ${error}`);
4311
+ done(error);
4312
+ }
4313
+ }).timeout(attemptTimeout);
4314
+ });
4315
+
4316
+ describe('#listdivisionICAassignments - errors', () => {
4317
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4318
+ try {
4319
+ a.listdivisionICAassignments('fakedata', null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
4320
+ try {
4321
+ if (stub) {
4322
+ const displayE = 'Error 400 received on request';
4323
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4324
+ } else {
4325
+ runCommonAsserts(data, error);
4326
+ }
4327
+ saveMockData('Divisions', 'listdivisionICAassignments', 'default', data);
4328
+ done();
4329
+ } catch (err) {
4330
+ log.error(`Test Failure: ${err}`);
4331
+ done(err);
4332
+ }
4333
+ });
4334
+ } catch (error) {
4335
+ log.error(`Adapter Exception: ${error}`);
4336
+ done(error);
4337
+ }
4338
+ }).timeout(attemptTimeout);
4339
+ });
4340
+
4341
+ describe('#listEnrollmentProfiles - errors', () => {
4342
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4343
+ try {
4344
+ a.listEnrollmentProfiles(null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
4345
+ try {
4346
+ if (stub) {
4347
+ const displayE = 'Error 400 received on request';
4348
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4349
+ } else {
4350
+ runCommonAsserts(data, error);
4351
+ }
4352
+ saveMockData('EnrollmentProfiles', 'listEnrollmentProfiles', 'default', data);
4353
+ done();
4354
+ } catch (err) {
4355
+ log.error(`Test Failure: ${err}`);
4356
+ done(err);
4357
+ }
4358
+ });
4359
+ } catch (error) {
4360
+ log.error(`Adapter Exception: ${error}`);
4361
+ done(error);
4362
+ }
4363
+ }).timeout(attemptTimeout);
4364
+ });
4365
+
4366
+ const enrollmentProfilesCreateEnrollmentProfileBodyParam = {
4367
+ enrollment_profile: {
4368
+ name: 'Example enrollment profile',
4369
+ device_profile_id: '7e873179-aab6-4acb-bfea-7dda35513926',
4370
+ enrollment_methods: [
4371
+ 'API'
4372
+ ],
4373
+ key_generation_option: 'client_or_server_side',
4374
+ key_generation_type: 'RSA_2048',
4375
+ key_generation_allow_to_change: true,
4376
+ certificate_profile_id: '803b8a1c-065e-4a11-95e4-40b19b76eab9',
4377
+ ica_id: 'AAC2E2DD6BEAE2E5EE93954BAE15E34D'
4378
+ }
4379
+ };
4380
+ describe('#createEnrollmentProfile - errors', () => {
4381
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4382
+ try {
4383
+ a.createEnrollmentProfile(enrollmentProfilesCreateEnrollmentProfileBodyParam, (data, error) => {
4384
+ try {
4385
+ if (stub) {
4386
+ const displayE = 'Error 400 received on request';
4387
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4388
+ } else {
4389
+ runCommonAsserts(data, error);
4390
+ }
4391
+ saveMockData('EnrollmentProfiles', 'createEnrollmentProfile', 'default', data);
4392
+ done();
4393
+ } catch (err) {
4394
+ log.error(`Test Failure: ${err}`);
4395
+ done(err);
4396
+ }
4397
+ });
4398
+ } catch (error) {
4399
+ log.error(`Adapter Exception: ${error}`);
4400
+ done(error);
4401
+ }
4402
+ }).timeout(attemptTimeout);
4403
+ });
4404
+
4405
+ describe('#getExampleCertificateRequestEnrollmentProfileID - errors', () => {
4406
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4407
+ try {
4408
+ a.getExampleCertificateRequestEnrollmentProfileID('fakedata', (data, error) => {
4409
+ try {
4410
+ if (stub) {
4411
+ const displayE = 'Error 400 received on request';
4412
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4413
+ } else {
4414
+ runCommonAsserts(data, error);
4415
+ }
4416
+ saveMockData('EnrollmentProfiles', 'getExampleCertificateRequestEnrollmentProfileID', 'default', data);
4417
+ done();
4418
+ } catch (err) {
4419
+ log.error(`Test Failure: ${err}`);
4420
+ done(err);
4421
+ }
4422
+ });
4423
+ } catch (error) {
4424
+ log.error(`Adapter Exception: ${error}`);
4425
+ done(error);
4426
+ }
4427
+ }).timeout(attemptTimeout);
4428
+ });
4429
+
4430
+ describe('#getEnrollmentProfile - errors', () => {
4431
+ it('should work if integrated or standalone with mockdata', (done) => {
4432
+ try {
4433
+ a.getEnrollmentProfile('fakedata', (data, error) => {
4434
+ try {
4435
+ if (stub) {
4436
+ runCommonAsserts(data, error);
4437
+ assert.equal('Example name', data.response.name);
4438
+ assert.equal(true, Array.isArray(data.response.enrollment_methods));
4439
+ assert.equal(true, Array.isArray(data.response.allowed_ip_addresses));
4440
+ assert.equal('09:45:00', data.response.allowed_hours_from);
4441
+ assert.equal('17:30:00', data.response.allowed_hours_to);
4442
+ assert.equal('America/New_York', data.response.timezone);
4443
+ assert.equal('2021-06-25', data.response.valid_from);
4444
+ assert.equal('2022-06-25', data.response.expires_on);
4445
+ assert.equal(true, data.response.key_generation_allow_to_change);
4446
+ assert.equal(false, data.response.allow_key_cache);
4447
+ assert.equal('string', data.response.key_cache_validity_period);
4448
+ assert.equal(false, data.response.require_approval_for_enroll);
4449
+ assert.equal(false, data.response.require_approval_for_renew);
4450
+ assert.equal(true, Array.isArray(data.response.approvers));
4451
+ assert.equal(true, Array.isArray(data.response.notification_email_list));
4452
+ assert.equal('IOT_502ac648-c826-4e71-991e-5629a23850c1', data.response.id);
4453
+ assert.equal('https://one.digicert.com', data.response.connector_url);
4454
+ assert.equal('passcode', data.response.passcode);
4455
+ assert.equal('<api_token>', data.response.api_key);
4456
+ assert.equal('<auth_cert_pkcs12>', data.response.auth_cert_pkcs12);
4457
+ assert.equal('passcode', data.response.auth_cert_password_pkcs12);
4458
+ assert.equal('string', data.response.external_enrollment_profile_id);
4459
+ assert.equal('object', typeof data.response.device_profile);
4460
+ assert.equal('object', typeof data.response.certificate_profile);
4461
+ assert.equal('2021-06-09T13:49:54Z', data.response.created_at);
4462
+ assert.equal('object', typeof data.response.ica);
4463
+ assert.equal(true, Array.isArray(data.response.allowed_signature_algorithms));
4464
+ assert.equal(true, data.response.direct_mapping);
4465
+ assert.equal('742a7efb-0cf1-499d-abd5-abb87f42aa5f', data.response.account_id);
4466
+ assert.equal('<certificate_data>', data.response.ca_body);
4467
+ assert.equal('<certificate_data>', data.response.gp_ca_body);
4468
+ assert.equal(true, Array.isArray(data.response.ca_chain));
4469
+ assert.equal(true, Array.isArray(data.response.gp_ca_chain));
4470
+ assert.equal('object', typeof data.response.certificate_template);
4471
+ } else {
4472
+ runCommonAsserts(data, error);
4473
+ }
4474
+ saveMockData('EnrollmentProfiles', 'getEnrollmentProfile', 'default', data);
4475
+ done();
4476
+ } catch (err) {
4477
+ log.error(`Test Failure: ${err}`);
4478
+ done(err);
4479
+ }
4480
+ });
4481
+ } catch (error) {
4482
+ log.error(`Adapter Exception: ${error}`);
4483
+ done(error);
4484
+ }
4485
+ }).timeout(attemptTimeout);
4486
+ });
4487
+
4488
+ const enrollmentProfilesUpdateEnrollmentProfileBodyParam = {
4489
+ name: 'Updated name',
4490
+ ica_id: 'AAC2E2DD6BEAE2E5EE93954BAE15E34D',
4491
+ allowed_ip_addresses: [
4492
+ '1.1.1.1',
4493
+ '2.2.2.2'
4494
+ ],
4495
+ certificate_profile_id: 'eb1ec97c-d0d6-4d66-ad29-af88fd86ab21',
4496
+ timezone: 'America/New_York',
4497
+ allowed_hours_from: '09:45:00',
4498
+ allowed_hours_to: '17:30:00',
4499
+ valid_from: '2021-06-25',
4500
+ expires_on: '2022-06-25',
4501
+ require_approval_for_enroll: true,
4502
+ require_approval_for_renew: true,
4503
+ allow_key_cache: true,
4504
+ key_cache_validity_period_type: null,
4505
+ key_cache_validity_period: '1',
4506
+ digest_email_notification_period: null,
4507
+ approvers: [
4508
+ 'string'
4509
+ ],
4510
+ notification_email_list: [
4511
+ 'string'
4512
+ ]
4513
+ };
4514
+ describe('#updateEnrollmentProfile - errors', () => {
4515
+ it('should work if integrated or standalone with mockdata', (done) => {
4516
+ try {
4517
+ a.updateEnrollmentProfile('fakedata', enrollmentProfilesUpdateEnrollmentProfileBodyParam, (data, error) => {
4518
+ try {
4519
+ if (stub) {
4520
+ runCommonAsserts(data, error);
4521
+ assert.equal('success', data.response);
4522
+ } else {
4523
+ runCommonAsserts(data, error);
4524
+ }
4525
+ saveMockData('EnrollmentProfiles', 'updateEnrollmentProfile', 'default', data);
4526
+ done();
4527
+ } catch (err) {
4528
+ log.error(`Test Failure: ${err}`);
4529
+ done(err);
4530
+ }
4531
+ });
4532
+ } catch (error) {
4533
+ log.error(`Adapter Exception: ${error}`);
4534
+ done(error);
4535
+ }
4536
+ }).timeout(attemptTimeout);
4537
+ });
4538
+
4539
+ describe('#listAssignableICAs - errors', () => {
4540
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4541
+ try {
4542
+ a.listAssignableICAs('fakedata', null, null, (data, error) => {
4543
+ try {
4544
+ if (stub) {
4545
+ const displayE = 'Error 400 received on request';
4546
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4547
+ } else {
4548
+ runCommonAsserts(data, error);
4549
+ }
4550
+ saveMockData('EnrollmentProfiles', 'listAssignableICAs', 'default', data);
4551
+ done();
4552
+ } catch (err) {
4553
+ log.error(`Test Failure: ${err}`);
4554
+ done(err);
4555
+ }
4556
+ });
4557
+ } catch (error) {
4558
+ log.error(`Adapter Exception: ${error}`);
4559
+ done(error);
4560
+ }
4561
+ }).timeout(attemptTimeout);
4562
+ });
4563
+
4564
+ describe('#getIssuingICA - errors', () => {
4565
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4566
+ try {
4567
+ a.getIssuingICA('fakedata', null, (data, error) => {
4568
+ try {
4569
+ if (stub) {
4570
+ const displayE = 'Error 400 received on request';
4571
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4572
+ } else {
4573
+ runCommonAsserts(data, error);
4574
+ }
4575
+ saveMockData('EnrollmentProfiles', 'getIssuingICA', 'default', data);
4576
+ done();
4577
+ } catch (err) {
4578
+ log.error(`Test Failure: ${err}`);
4579
+ done(err);
4580
+ }
4581
+ });
4582
+ } catch (error) {
4583
+ log.error(`Adapter Exception: ${error}`);
4584
+ done(error);
4585
+ }
4586
+ }).timeout(attemptTimeout);
4587
+ });
4588
+
4589
+ describe('#getEnrollmentProfileSpecification - errors', () => {
4590
+ it('should work if integrated or standalone with mockdata', (done) => {
4591
+ try {
4592
+ a.getEnrollmentProfileSpecification('fakedata', (data, error) => {
4593
+ try {
4594
+ if (stub) {
4595
+ runCommonAsserts(data, error);
4596
+ assert.equal(true, Array.isArray(data.response.fields));
4597
+ } else {
4598
+ runCommonAsserts(data, error);
4599
+ }
4600
+ saveMockData('EnrollmentProfiles', 'getEnrollmentProfileSpecification', 'default', data);
4601
+ done();
4602
+ } catch (err) {
4603
+ log.error(`Test Failure: ${err}`);
4604
+ done(err);
4605
+ }
4606
+ });
4607
+ } catch (error) {
4608
+ log.error(`Adapter Exception: ${error}`);
4609
+ done(error);
4610
+ }
4611
+ }).timeout(attemptTimeout);
4612
+ });
4613
+
4614
+ describe('#getEnrollmentProfileStatus - errors', () => {
4615
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4616
+ try {
4617
+ a.getEnrollmentProfileStatus('fakedata', (data, error) => {
4618
+ try {
4619
+ if (stub) {
4620
+ const displayE = 'Error 400 received on request';
4621
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4622
+ } else {
4623
+ runCommonAsserts(data, error);
4624
+ }
4625
+ saveMockData('EnrollmentProfiles', 'getEnrollmentProfileStatus', 'default', data);
4626
+ done();
4627
+ } catch (err) {
4628
+ log.error(`Test Failure: ${err}`);
4629
+ done(err);
4630
+ }
4631
+ });
4632
+ } catch (error) {
4633
+ log.error(`Adapter Exception: ${error}`);
4634
+ done(error);
4635
+ }
4636
+ }).timeout(attemptTimeout);
4637
+ });
4638
+
4639
+ describe('#listEnrollmentPasscodes - errors', () => {
4640
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4641
+ try {
4642
+ a.listEnrollmentPasscodes(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
4643
+ try {
4644
+ if (stub) {
4645
+ const displayE = 'Error 400 received on request';
4646
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4647
+ } else {
4648
+ runCommonAsserts(data, error);
4649
+ }
4650
+ saveMockData('EnrollmentProfilePasscodes', 'listEnrollmentPasscodes', 'default', data);
4651
+ done();
4652
+ } catch (err) {
4653
+ log.error(`Test Failure: ${err}`);
4654
+ done(err);
4655
+ }
4656
+ });
4657
+ } catch (error) {
4658
+ log.error(`Adapter Exception: ${error}`);
4659
+ done(error);
4660
+ }
4661
+ }).timeout(attemptTimeout);
4662
+ });
4663
+
4664
+ const enrollmentProfilePasscodesCreateEnrollmentPasscodeBodyParam = {
4665
+ name: 'Passcode name'
4666
+ };
4667
+ describe('#createEnrollmentPasscode - errors', () => {
4668
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4669
+ try {
4670
+ a.createEnrollmentPasscode('fakedata', enrollmentProfilePasscodesCreateEnrollmentPasscodeBodyParam, (data, error) => {
4671
+ try {
4672
+ if (stub) {
4673
+ const displayE = 'Error 400 received on request';
4674
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4675
+ } else {
4676
+ runCommonAsserts(data, error);
4677
+ }
4678
+ saveMockData('EnrollmentProfilePasscodes', 'createEnrollmentPasscode', 'default', data);
4679
+ done();
4680
+ } catch (err) {
4681
+ log.error(`Test Failure: ${err}`);
4682
+ done(err);
4683
+ }
4684
+ });
4685
+ } catch (error) {
4686
+ log.error(`Adapter Exception: ${error}`);
4687
+ done(error);
4688
+ }
4689
+ }).timeout(attemptTimeout);
4690
+ });
4691
+
4692
+ describe('#getEnrollmentPasscodeDetails - errors', () => {
4693
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4694
+ try {
4695
+ a.getEnrollmentPasscodeDetails('fakedata', 'fakedata', (data, error) => {
4696
+ try {
4697
+ if (stub) {
4698
+ const displayE = 'Error 400 received on request';
4699
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4700
+ } else {
4701
+ runCommonAsserts(data, error);
4702
+ }
4703
+ saveMockData('EnrollmentProfilePasscodes', 'getEnrollmentPasscodeDetails', 'default', data);
4704
+ done();
4705
+ } catch (err) {
4706
+ log.error(`Test Failure: ${err}`);
4707
+ done(err);
4708
+ }
4709
+ });
4710
+ } catch (error) {
4711
+ log.error(`Adapter Exception: ${error}`);
4712
+ done(error);
4713
+ }
4714
+ }).timeout(attemptTimeout);
4715
+ });
4716
+
4717
+ const enrollmentProfilePasscodesUpdateEnrollmentPasscodeBodyParam = {
4718
+ name: 'Passcode name'
4719
+ };
4720
+ describe('#updateEnrollmentPasscode - errors', () => {
4721
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4722
+ try {
4723
+ a.updateEnrollmentPasscode('fakedata', 'fakedata', enrollmentProfilePasscodesUpdateEnrollmentPasscodeBodyParam, (data, error) => {
4724
+ try {
4725
+ if (stub) {
4726
+ const displayE = 'Error 400 received on request';
4727
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4728
+ } else {
4729
+ runCommonAsserts(data, error);
4730
+ }
4731
+ saveMockData('EnrollmentProfilePasscodes', 'updateEnrollmentPasscode', 'default', data);
4732
+ done();
4733
+ } catch (err) {
4734
+ log.error(`Test Failure: ${err}`);
4735
+ done(err);
4736
+ }
4737
+ });
4738
+ } catch (error) {
4739
+ log.error(`Adapter Exception: ${error}`);
4740
+ done(error);
4741
+ }
4742
+ }).timeout(attemptTimeout);
4743
+ });
4744
+
4745
+ describe('#deleteEnrollmentPasscode - errors', () => {
4746
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4747
+ try {
4748
+ a.deleteEnrollmentPasscode('fakedata', 'fakedata', (data, error) => {
4749
+ try {
4750
+ if (stub) {
4751
+ const displayE = 'Error 400 received on request';
4752
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4753
+ } else {
4754
+ runCommonAsserts(data, error);
4755
+ }
4756
+ saveMockData('EnrollmentProfilePasscodes', 'deleteEnrollmentPasscode', 'default', data);
4757
+ done();
4758
+ } catch (err) {
4759
+ log.error(`Test Failure: ${err}`);
4760
+ done(err);
4761
+ }
4762
+ });
4763
+ } catch (error) {
4764
+ log.error(`Adapter Exception: ${error}`);
4765
+ done(error);
4766
+ }
4767
+ }).timeout(attemptTimeout);
4768
+ });
4769
+
4770
+ describe('#restoreEnrollmentPasscode - errors', () => {
4771
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4772
+ try {
4773
+ a.restoreEnrollmentPasscode('fakedata', 'fakedata', (data, error) => {
4774
+ try {
4775
+ if (stub) {
4776
+ const displayE = 'Error 400 received on request';
4777
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4778
+ } else {
4779
+ runCommonAsserts(data, error);
4780
+ }
4781
+ saveMockData('EnrollmentProfilePasscodes', 'restoreEnrollmentPasscode', 'default', data);
4782
+ done();
4783
+ } catch (err) {
4784
+ log.error(`Test Failure: ${err}`);
4785
+ done(err);
4786
+ }
4787
+ });
4788
+ } catch (error) {
4789
+ log.error(`Adapter Exception: ${error}`);
4790
+ done(error);
4791
+ }
4792
+ }).timeout(attemptTimeout);
4793
+ });
4794
+
4795
+ describe('#disableEnrollmentPasscode - errors', () => {
4796
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4797
+ try {
4798
+ a.disableEnrollmentPasscode('fakedata', 'fakedata', (data, error) => {
4799
+ try {
4800
+ if (stub) {
4801
+ const displayE = 'Error 400 received on request';
4802
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4803
+ } else {
4804
+ runCommonAsserts(data, error);
4805
+ }
4806
+ saveMockData('EnrollmentProfilePasscodes', 'disableEnrollmentPasscode', 'default', data);
4807
+ done();
4808
+ } catch (err) {
4809
+ log.error(`Test Failure: ${err}`);
4810
+ done(err);
4811
+ }
4812
+ });
4813
+ } catch (error) {
4814
+ log.error(`Adapter Exception: ${error}`);
4815
+ done(error);
4816
+ }
4817
+ }).timeout(attemptTimeout);
4818
+ });
4819
+
4820
+ describe('#enableEnrollmentPasscode - errors', () => {
4821
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4822
+ try {
4823
+ a.enableEnrollmentPasscode('fakedata', 'fakedata', (data, error) => {
4824
+ try {
4825
+ if (stub) {
4826
+ const displayE = 'Error 400 received on request';
4827
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4828
+ } else {
4829
+ runCommonAsserts(data, error);
4830
+ }
4831
+ saveMockData('EnrollmentProfilePasscodes', 'enableEnrollmentPasscode', 'default', data);
4832
+ done();
4833
+ } catch (err) {
4834
+ log.error(`Test Failure: ${err}`);
4835
+ done(err);
4836
+ }
4837
+ });
4838
+ } catch (error) {
4839
+ log.error(`Adapter Exception: ${error}`);
4840
+ done(error);
4841
+ }
4842
+ }).timeout(attemptTimeout);
4843
+ });
4844
+
4845
+ describe('#regenerateEnrollmentPasscode - errors', () => {
4846
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
4847
+ try {
4848
+ a.regenerateEnrollmentPasscode('fakedata', 'fakedata', (data, error) => {
4849
+ try {
4850
+ if (stub) {
4851
+ const displayE = 'Error 400 received on request';
4852
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
4853
+ } else {
4854
+ runCommonAsserts(data, error);
4855
+ }
4856
+ saveMockData('EnrollmentProfilePasscodes', 'regenerateEnrollmentPasscode', 'default', data);
4857
+ done();
4858
+ } catch (err) {
4859
+ log.error(`Test Failure: ${err}`);
4860
+ done(err);
4861
+ }
4862
+ });
4863
+ } catch (error) {
4864
+ log.error(`Adapter Exception: ${error}`);
4865
+ done(error);
4866
+ }
4867
+ }).timeout(attemptTimeout);
4868
+ });
4869
+
4870
+ const aCMECreateAcmeAuthenticationBodyParam = {
4871
+ name: 'Custom name',
4872
+ account_id: 'e44757da-bdcc-5442-c568-734cc233281b',
4873
+ authentication_pem: '-----BEGIN PUBLIC KEY-----...'
4874
+ };
4875
+ describe('#createAcmeAuthentication - errors', () => {
4876
+ it('should work if integrated or standalone with mockdata', (done) => {
4877
+ try {
4878
+ a.createAcmeAuthentication(aCMECreateAcmeAuthenticationBodyParam, (data, error) => {
4879
+ try {
4880
+ if (stub) {
4881
+ runCommonAsserts(data, error);
4882
+ assert.equal('f92834ce-cdea-1584-b154-193bb198345e', data.response.id);
4883
+ assert.equal('Example ACME Credentials', data.response.name);
4884
+ assert.equal('Test', data.response.description);
4885
+ assert.equal('1d1ec1ec-6502-11e9-a923-1681be663d3e', data.response.account_id);
4886
+ assert.equal('-----BEGIN PUBLIC KEY-----...', data.response.authentication_pem);
4887
+ assert.equal('9e00a421268a1e814805cb0571a157d2fdbd9b48a02286c77d4e76110727727d', data.response.thumbprint);
4888
+ assert.equal('ACTIVE', data.response.status);
4889
+ assert.equal('2021-02-18T21:02:15.285249Z', data.response.created_at);
4890
+ assert.equal(3, data.response.rsa_key_size);
4891
+ assert.equal('string', data.response.ecdsa_curve);
4892
+ assert.equal('string', data.response.key_description);
4893
+ assert.equal('example_common_name', data.response.certificate_common_name);
4894
+ assert.equal('example_issuing_certificate', data.response.issuer_common_name);
4895
+ assert.equal('FS3f8Q7yUZQQO4uLUP8vAyREMCKyUqRr7JoHy1aquKiPYwu42r67CcELWlYRy9oJyzJ09n5oojJzz9t0EhWiNQ', data.response.hmac_key);
4896
+ assert.equal(true, data.response.external_account_binding);
4897
+ assert.equal(false, data.response.account_bind);
4898
+ assert.equal('----BEGIN PUBLIC KEY-----...', data.response.public_key_pem);
4899
+ } else {
4900
+ runCommonAsserts(data, error);
4901
+ }
4902
+ saveMockData('ACME', 'createAcmeAuthentication', 'default', data);
4903
+ done();
4904
+ } catch (err) {
4905
+ log.error(`Test Failure: ${err}`);
4906
+ done(err);
4907
+ }
4908
+ });
4909
+ } catch (error) {
4910
+ log.error(`Adapter Exception: ${error}`);
4911
+ done(error);
4912
+ }
4913
+ }).timeout(attemptTimeout);
4914
+ });
4915
+
4916
+ describe('#listAcmeAuthentication - errors', () => {
4917
+ it('should work if integrated or standalone with mockdata', (done) => {
4918
+ try {
4919
+ a.listAcmeAuthentication(null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
4920
+ try {
4921
+ if (stub) {
4922
+ runCommonAsserts(data, error);
4923
+ assert.equal(20, data.response.limit);
4924
+ assert.equal(0, data.response.offset);
4925
+ assert.equal(true, data.response.pagination);
4926
+ assert.equal(false, data.response.next);
4927
+ assert.equal(2, data.response.total);
4928
+ assert.equal(true, Array.isArray(data.response.records));
4929
+ } else {
4930
+ runCommonAsserts(data, error);
4931
+ }
4932
+ saveMockData('ACME', 'listAcmeAuthentication', 'default', data);
4933
+ done();
4934
+ } catch (err) {
4935
+ log.error(`Test Failure: ${err}`);
4936
+ done(err);
4937
+ }
4938
+ });
4939
+ } catch (error) {
4940
+ log.error(`Adapter Exception: ${error}`);
4941
+ done(error);
4942
+ }
4943
+ }).timeout(attemptTimeout);
4944
+ });
4945
+
4946
+ describe('#getAcmeAuthentication - errors', () => {
4947
+ it('should work if integrated or standalone with mockdata', (done) => {
4948
+ try {
4949
+ a.getAcmeAuthentication('fakedata', (data, error) => {
4950
+ try {
4951
+ if (stub) {
4952
+ runCommonAsserts(data, error);
4953
+ assert.equal('f92834ce-cdea-1584-b154-193bb198345e', data.response.id);
4954
+ assert.equal('Example ACME Credentials', data.response.name);
4955
+ assert.equal('Test', data.response.description);
4956
+ assert.equal('1d1ec1ec-6502-11e9-a923-1681be663d3e', data.response.account_id);
4957
+ assert.equal('-----BEGIN PUBLIC KEY-----...', data.response.authentication_pem);
4958
+ assert.equal('9e00a421268a1e814805cb0571a157d2fdbd9b48a02286c77d4e76110727727d', data.response.thumbprint);
4959
+ assert.equal('ACTIVE', data.response.status);
4960
+ assert.equal('2021-02-18T21:02:15.285249Z', data.response.created_at);
4961
+ assert.equal(8, data.response.rsa_key_size);
4962
+ assert.equal('string', data.response.ecdsa_curve);
4963
+ assert.equal('string', data.response.key_description);
4964
+ assert.equal('example_common_name', data.response.certificate_common_name);
4965
+ assert.equal('example_issuing_certificate', data.response.issuer_common_name);
4966
+ assert.equal('FS3f8Q7yUZQQO4uLUP8vAyREMCKyUqRr7JoHy1aquKiPYwu42r67CcELWlYRy9oJyzJ09n5oojJzz9t0EhWiNQ', data.response.hmac_key);
4967
+ assert.equal(true, data.response.external_account_binding);
4968
+ assert.equal(false, data.response.account_bind);
4969
+ assert.equal('----BEGIN PUBLIC KEY-----...', data.response.public_key_pem);
4970
+ } else {
4971
+ runCommonAsserts(data, error);
4972
+ }
4973
+ saveMockData('ACME', 'getAcmeAuthentication', 'default', data);
4974
+ done();
4975
+ } catch (err) {
4976
+ log.error(`Test Failure: ${err}`);
4977
+ done(err);
4978
+ }
4979
+ });
4980
+ } catch (error) {
4981
+ log.error(`Adapter Exception: ${error}`);
4982
+ done(error);
4983
+ }
4984
+ }).timeout(attemptTimeout);
4985
+ });
4986
+
4987
+ const aCMEUpdateAcmeAuthenticationBodyParam = {
4988
+ name: 'New name'
4989
+ };
4990
+ describe('#updateAcmeAuthentication - errors', () => {
4991
+ it('should work if integrated or standalone with mockdata', (done) => {
4992
+ try {
4993
+ a.updateAcmeAuthentication('fakedata', aCMEUpdateAcmeAuthenticationBodyParam, (data, error) => {
4994
+ try {
4995
+ if (stub) {
4996
+ runCommonAsserts(data, error);
4997
+ assert.equal('success', data.response);
4998
+ } else {
4999
+ runCommonAsserts(data, error);
5000
+ }
5001
+ saveMockData('ACME', 'updateAcmeAuthentication', 'default', data);
5002
+ done();
5003
+ } catch (err) {
5004
+ log.error(`Test Failure: ${err}`);
5005
+ done(err);
5006
+ }
5007
+ });
5008
+ } catch (error) {
5009
+ log.error(`Adapter Exception: ${error}`);
5010
+ done(error);
5011
+ }
5012
+ }).timeout(attemptTimeout);
5013
+ });
5014
+
5015
+ describe('#disableAcmeAuthentication - errors', () => {
5016
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5017
+ try {
5018
+ a.disableAcmeAuthentication('fakedata', (data, error) => {
5019
+ try {
5020
+ if (stub) {
5021
+ const displayE = 'Error 400 received on request';
5022
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5023
+ } else {
5024
+ runCommonAsserts(data, error);
5025
+ }
5026
+ saveMockData('ACME', 'disableAcmeAuthentication', 'default', data);
5027
+ done();
5028
+ } catch (err) {
5029
+ log.error(`Test Failure: ${err}`);
5030
+ done(err);
5031
+ }
5032
+ });
5033
+ } catch (error) {
5034
+ log.error(`Adapter Exception: ${error}`);
5035
+ done(error);
5036
+ }
5037
+ }).timeout(attemptTimeout);
5038
+ });
5039
+
5040
+ describe('#enableAcmeAuthentication - errors', () => {
5041
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5042
+ try {
5043
+ a.enableAcmeAuthentication('fakedata', (data, error) => {
5044
+ try {
5045
+ if (stub) {
5046
+ const displayE = 'Error 400 received on request';
5047
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5048
+ } else {
5049
+ runCommonAsserts(data, error);
5050
+ }
5051
+ saveMockData('ACME', 'enableAcmeAuthentication', 'default', data);
5052
+ done();
5053
+ } catch (err) {
5054
+ log.error(`Test Failure: ${err}`);
5055
+ done(err);
5056
+ }
5057
+ });
5058
+ } catch (error) {
5059
+ log.error(`Adapter Exception: ${error}`);
5060
+ done(error);
5061
+ }
5062
+ }).timeout(attemptTimeout);
5063
+ });
5064
+
5065
+ describe('#deleteAcmeAuthentication - errors', () => {
5066
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5067
+ try {
5068
+ a.deleteAcmeAuthentication('fakedata', (data, error) => {
5069
+ try {
5070
+ if (stub) {
5071
+ const displayE = 'Error 400 received on request';
5072
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5073
+ } else {
5074
+ runCommonAsserts(data, error);
5075
+ }
5076
+ saveMockData('ACME', 'deleteAcmeAuthentication', 'default', data);
5077
+ done();
5078
+ } catch (err) {
5079
+ log.error(`Test Failure: ${err}`);
5080
+ done(err);
5081
+ }
5082
+ });
5083
+ } catch (error) {
5084
+ log.error(`Adapter Exception: ${error}`);
5085
+ done(error);
5086
+ }
5087
+ }).timeout(attemptTimeout);
5088
+ });
5089
+
5090
+ describe('#restoreAcmeAuthentication - errors', () => {
5091
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5092
+ try {
5093
+ a.restoreAcmeAuthentication('fakedata', (data, error) => {
5094
+ try {
5095
+ if (stub) {
5096
+ const displayE = 'Error 400 received on request';
5097
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5098
+ } else {
5099
+ runCommonAsserts(data, error);
5100
+ }
5101
+ saveMockData('ACME', 'restoreAcmeAuthentication', 'default', data);
5102
+ done();
5103
+ } catch (err) {
5104
+ log.error(`Test Failure: ${err}`);
5105
+ done(err);
5106
+ }
5107
+ });
5108
+ } catch (error) {
5109
+ log.error(`Adapter Exception: ${error}`);
5110
+ done(error);
5111
+ }
5112
+ }).timeout(attemptTimeout);
5113
+ });
5114
+
5115
+ describe('#batchCSREnroll - errors', () => {
5116
+ it('should work if integrated or standalone with mockdata', (done) => {
5117
+ try {
5118
+ a.batchCSREnroll('fakedata', null, 'fakedata', 'fakedata', [], null, null, null, null, null, null, (data, error) => {
5119
+ try {
5120
+ if (stub) {
5121
+ runCommonAsserts(data, error);
5122
+ assert.equal('da342f63-dead-4bae-a065-eb8822948148', data.response.id);
5123
+ assert.equal('Example batch job', data.response.name);
5124
+ assert.equal(10, data.response.total_items);
5125
+ assert.equal(6, data.response.failed_items);
5126
+ assert.equal(900, data.response.processing_time);
5127
+ assert.equal('string', data.response.passcode);
5128
+ assert.equal('Example description.', data.response.description);
5129
+ assert.equal(true, Array.isArray(data.response.emails));
5130
+ assert.equal(true, Array.isArray(data.response.external_emails));
5131
+ assert.equal(false, data.response.data_available);
5132
+ } else {
5133
+ runCommonAsserts(data, error);
5134
+ }
5135
+ saveMockData('BatchCertificateEnrollment', 'batchCSREnroll', 'default', data);
5136
+ done();
5137
+ } catch (err) {
5138
+ log.error(`Test Failure: ${err}`);
5139
+ done(err);
5140
+ }
5141
+ });
5142
+ } catch (error) {
5143
+ log.error(`Adapter Exception: ${error}`);
5144
+ done(error);
5145
+ }
5146
+ }).timeout(attemptTimeout);
5147
+ });
5148
+
5149
+ describe('#batchEnrollWithKeyGen - errors', () => {
5150
+ it('should work if integrated or standalone with mockdata', (done) => {
5151
+ try {
5152
+ a.batchEnrollWithKeyGen('fakedata', null, 'fakedata', null, null, null, 'fakedata', [], 'fakedata', 'fakedata', null, null, null, null, (data, error) => {
5153
+ try {
5154
+ if (stub) {
5155
+ runCommonAsserts(data, error);
5156
+ assert.equal('da342f63-dead-4bae-a065-eb8822948148', data.response.id);
5157
+ assert.equal('Example batch job', data.response.name);
5158
+ assert.equal(10, data.response.total_items);
5159
+ assert.equal(7, data.response.failed_items);
5160
+ assert.equal(900, data.response.processing_time);
5161
+ assert.equal('string', data.response.passcode);
5162
+ assert.equal('Example description.', data.response.description);
5163
+ assert.equal(true, Array.isArray(data.response.emails));
5164
+ assert.equal(true, Array.isArray(data.response.external_emails));
5165
+ assert.equal(false, data.response.data_available);
5166
+ } else {
5167
+ runCommonAsserts(data, error);
5168
+ }
5169
+ saveMockData('BatchCertificateEnrollment', 'batchEnrollWithKeyGen', 'default', data);
5170
+ done();
5171
+ } catch (err) {
5172
+ log.error(`Test Failure: ${err}`);
5173
+ done(err);
5174
+ }
5175
+ });
5176
+ } catch (error) {
5177
+ log.error(`Adapter Exception: ${error}`);
5178
+ done(error);
5179
+ }
5180
+ }).timeout(attemptTimeout);
5181
+ });
5182
+
5183
+ describe('#batchEnrollWithKeyGenMac - errors', () => {
5184
+ it('should work if integrated or standalone with mockdata', (done) => {
5185
+ try {
5186
+ a.batchEnrollWithKeyGenMac('fakedata', null, 'fakedata', null, null, null, 'fakedata', 555, 555, [], 'fakedata', 'fakedata', null, null, null, null, (data, error) => {
5187
+ try {
5188
+ if (stub) {
5189
+ runCommonAsserts(data, error);
5190
+ assert.equal('da342f63-dead-4bae-a065-eb8822948148', data.response.id);
5191
+ assert.equal('Example batch job', data.response.name);
5192
+ assert.equal(10, data.response.total_items);
5193
+ assert.equal(1, data.response.failed_items);
5194
+ assert.equal(900, data.response.processing_time);
5195
+ assert.equal('string', data.response.passcode);
5196
+ assert.equal('Example description.', data.response.description);
5197
+ assert.equal(true, Array.isArray(data.response.emails));
5198
+ assert.equal(true, Array.isArray(data.response.external_emails));
5199
+ assert.equal(true, data.response.data_available);
5200
+ } else {
5201
+ runCommonAsserts(data, error);
5202
+ }
5203
+ saveMockData('BatchCertificateEnrollment', 'batchEnrollWithKeyGenMac', 'default', data);
5204
+ done();
5205
+ } catch (err) {
5206
+ log.error(`Test Failure: ${err}`);
5207
+ done(err);
5208
+ }
5209
+ });
5210
+ } catch (error) {
5211
+ log.error(`Adapter Exception: ${error}`);
5212
+ done(error);
5213
+ }
5214
+ }).timeout(attemptTimeout);
5215
+ });
5216
+
5217
+ describe('#listBatchJobs - errors', () => {
5218
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5219
+ try {
5220
+ a.listBatchJobs(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
5221
+ try {
5222
+ if (stub) {
5223
+ const displayE = 'Error 400 received on request';
5224
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5225
+ } else {
5226
+ runCommonAsserts(data, error);
5227
+ }
5228
+ saveMockData('BatchCertificateEnrollment', 'listBatchJobs', 'default', data);
5229
+ done();
5230
+ } catch (err) {
5231
+ log.error(`Test Failure: ${err}`);
5232
+ done(err);
5233
+ }
5234
+ });
5235
+ } catch (error) {
5236
+ log.error(`Adapter Exception: ${error}`);
5237
+ done(error);
5238
+ }
5239
+ }).timeout(attemptTimeout);
5240
+ });
5241
+
5242
+ describe('#getBatchJobSettings - errors', () => {
5243
+ it('should work if integrated or standalone with mockdata', (done) => {
5244
+ try {
5245
+ a.getBatchJobSettings('fakedata', (data, error) => {
5246
+ try {
5247
+ if (stub) {
5248
+ runCommonAsserts(data, error);
5249
+ assert.equal('e197ba9d-3af3-4012-9861-d214cce33cd8', data.response.id);
5250
+ assert.equal('Example batch job', data.response.name);
5251
+ assert.equal(10, data.response.total_items);
5252
+ assert.equal(9, data.response.failed_items);
5253
+ assert.equal(900, data.response.processing_time);
5254
+ assert.equal('string', data.response.passcode);
5255
+ assert.equal('Example description.', data.response.description);
5256
+ assert.equal(true, Array.isArray(data.response.emails));
5257
+ assert.equal(true, Array.isArray(data.response.external_emails));
5258
+ assert.equal(false, data.response.data_available);
5259
+ } else {
5260
+ runCommonAsserts(data, error);
5261
+ }
5262
+ saveMockData('BatchCertificateEnrollment', 'getBatchJobSettings', 'default', data);
5263
+ done();
5264
+ } catch (err) {
5265
+ log.error(`Test Failure: ${err}`);
5266
+ done(err);
5267
+ }
5268
+ });
5269
+ } catch (error) {
5270
+ log.error(`Adapter Exception: ${error}`);
5271
+ done(error);
5272
+ }
5273
+ }).timeout(attemptTimeout);
5274
+ });
5275
+
5276
+ const batchCertificateEnrollmentUpdateBatchJobSettingsBodyParam = {
5277
+ name: 'string',
5278
+ emails: [
5279
+ 'bob@example.com',
5280
+ 'alice@example.com'
5281
+ ],
5282
+ description: 'Example description.',
5283
+ external_emails: [
5284
+ 'john@example.com',
5285
+ 'jane@example.com'
5286
+ ],
5287
+ passcode_generation_option: null,
5288
+ passcode: 'string'
5289
+ };
5290
+ describe('#updateBatchJobSettings - errors', () => {
5291
+ it('should work if integrated or standalone with mockdata', (done) => {
5292
+ try {
5293
+ a.updateBatchJobSettings('fakedata', batchCertificateEnrollmentUpdateBatchJobSettingsBodyParam, (data, error) => {
5294
+ try {
5295
+ if (stub) {
5296
+ runCommonAsserts(data, error);
5297
+ assert.equal('success', data.response);
5298
+ } else {
5299
+ runCommonAsserts(data, error);
5300
+ }
5301
+ saveMockData('BatchCertificateEnrollment', 'updateBatchJobSettings', 'default', data);
5302
+ done();
5303
+ } catch (err) {
5304
+ log.error(`Test Failure: ${err}`);
5305
+ done(err);
5306
+ }
5307
+ });
5308
+ } catch (error) {
5309
+ log.error(`Adapter Exception: ${error}`);
5310
+ done(error);
5311
+ }
5312
+ }).timeout(attemptTimeout);
5313
+ });
5314
+
5315
+ describe('#regenerateBatchJobPasscode - errors', () => {
5316
+ it('should work if integrated or standalone with mockdata', (done) => {
5317
+ try {
5318
+ a.regenerateBatchJobPasscode('fakedata', (data, error) => {
5319
+ try {
5320
+ if (stub) {
5321
+ runCommonAsserts(data, error);
5322
+ assert.equal('success', data.response);
5323
+ } else {
5324
+ runCommonAsserts(data, error);
5325
+ }
5326
+ saveMockData('BatchCertificateEnrollment', 'regenerateBatchJobPasscode', 'default', data);
5327
+ done();
5328
+ } catch (err) {
5329
+ log.error(`Test Failure: ${err}`);
5330
+ done(err);
5331
+ }
5332
+ });
5333
+ } catch (error) {
5334
+ log.error(`Adapter Exception: ${error}`);
5335
+ done(error);
5336
+ }
5337
+ }).timeout(attemptTimeout);
5338
+ });
5339
+
5340
+ describe('#approveJob - errors', () => {
5341
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5342
+ try {
5343
+ a.approveJob('fakedata', (data, error) => {
5344
+ try {
5345
+ if (stub) {
5346
+ const displayE = 'Error 400 received on request';
5347
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5348
+ } else {
5349
+ runCommonAsserts(data, error);
5350
+ }
5351
+ saveMockData('BatchCertificateEnrollment', 'approveJob', 'default', data);
5352
+ done();
5353
+ } catch (err) {
5354
+ log.error(`Test Failure: ${err}`);
5355
+ done(err);
5356
+ }
5357
+ });
5358
+ } catch (error) {
5359
+ log.error(`Adapter Exception: ${error}`);
5360
+ done(error);
5361
+ }
5362
+ }).timeout(attemptTimeout);
5363
+ });
5364
+
5365
+ const batchCertificateEnrollmentRejectJobBodyParam = {
5366
+ rejection_reason: 'string'
5367
+ };
5368
+ describe('#rejectJob - errors', () => {
5369
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5370
+ try {
5371
+ a.rejectJob('fakedata', batchCertificateEnrollmentRejectJobBodyParam, (data, error) => {
5372
+ try {
5373
+ if (stub) {
5374
+ const displayE = 'Error 400 received on request';
5375
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5376
+ } else {
5377
+ runCommonAsserts(data, error);
5378
+ }
5379
+ saveMockData('BatchCertificateEnrollment', 'rejectJob', 'default', data);
5380
+ done();
5381
+ } catch (err) {
5382
+ log.error(`Test Failure: ${err}`);
5383
+ done(err);
5384
+ }
5385
+ });
5386
+ } catch (error) {
5387
+ log.error(`Adapter Exception: ${error}`);
5388
+ done(error);
5389
+ }
5390
+ }).timeout(attemptTimeout);
5391
+ });
5392
+
5393
+ describe('#downloadReport - errors', () => {
5394
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5395
+ try {
5396
+ a.downloadReport('fakedata', (data, error) => {
5397
+ try {
5398
+ if (stub) {
5399
+ const displayE = 'Error 400 received on request';
5400
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5401
+ } else {
5402
+ runCommonAsserts(data, error);
5403
+ }
5404
+ saveMockData('BatchCertificateEnrollment', 'downloadReport', 'default', data);
5405
+ done();
5406
+ } catch (err) {
5407
+ log.error(`Test Failure: ${err}`);
5408
+ done(err);
5409
+ }
5410
+ });
5411
+ } catch (error) {
5412
+ log.error(`Adapter Exception: ${error}`);
5413
+ done(error);
5414
+ }
5415
+ }).timeout(attemptTimeout);
5416
+ });
5417
+
5418
+ describe('#downloadCertificates - errors', () => {
5419
+ it('should work if integrated or standalone with mockdata', (done) => {
5420
+ try {
5421
+ a.downloadCertificates('fakedata', (data, error) => {
5422
+ try {
5423
+ if (stub) {
5424
+ runCommonAsserts(data, error);
5425
+ assert.equal('04fa5382-00e0-4322-813d-fcce9747d51f', data.response.job_id);
5426
+ assert.equal(true, Array.isArray(data.response.chain));
5427
+ assert.equal(true, Array.isArray(data.response.certificates));
5428
+ } else {
5429
+ runCommonAsserts(data, error);
5430
+ }
5431
+ saveMockData('BatchCertificateEnrollment', 'downloadCertificates', 'default', data);
5432
+ done();
5433
+ } catch (err) {
5434
+ log.error(`Test Failure: ${err}`);
5435
+ done(err);
5436
+ }
5437
+ });
5438
+ } catch (error) {
5439
+ log.error(`Adapter Exception: ${error}`);
5440
+ done(error);
5441
+ }
5442
+ }).timeout(attemptTimeout);
5443
+ });
5444
+
5445
+ describe('#deleteDownloadUrls - errors', () => {
5446
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5447
+ try {
5448
+ a.deleteDownloadUrls('fakedata', (data, error) => {
5449
+ try {
5450
+ if (stub) {
5451
+ const displayE = 'Error 400 received on request';
5452
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5453
+ } else {
5454
+ runCommonAsserts(data, error);
5455
+ }
5456
+ saveMockData('BatchCertificateEnrollment', 'deleteDownloadUrls', 'default', data);
5457
+ done();
5458
+ } catch (err) {
5459
+ log.error(`Test Failure: ${err}`);
5460
+ done(err);
5461
+ }
5462
+ });
5463
+ } catch (error) {
5464
+ log.error(`Adapter Exception: ${error}`);
5465
+ done(error);
5466
+ }
5467
+ }).timeout(attemptTimeout);
5468
+ });
5469
+
5470
+ describe('#resendDownloadUrls - errors', () => {
5471
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5472
+ try {
5473
+ a.resendDownloadUrls('fakedata', (data, error) => {
5474
+ try {
5475
+ if (stub) {
5476
+ const displayE = 'Error 400 received on request';
5477
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5478
+ } else {
5479
+ runCommonAsserts(data, error);
5480
+ }
5481
+ saveMockData('BatchCertificateEnrollment', 'resendDownloadUrls', 'default', data);
5482
+ done();
5483
+ } catch (err) {
5484
+ log.error(`Test Failure: ${err}`);
5485
+ done(err);
5486
+ }
5487
+ });
5488
+ } catch (error) {
5489
+ log.error(`Adapter Exception: ${error}`);
5490
+ done(error);
5491
+ }
5492
+ }).timeout(attemptTimeout);
5493
+ });
5494
+
5495
+ describe('#batchEnrollExternal - errors', () => {
5496
+ it('should work if integrated or standalone with mockdata', (done) => {
5497
+ try {
5498
+ a.batchEnrollExternal('fakedata', null, 'fakedata', [], null, null, null, (data, error) => {
5499
+ try {
5500
+ if (stub) {
5501
+ runCommonAsserts(data, error);
5502
+ assert.equal('a7cdd1ac-8e64-417e-80d7-c5c2d8bab0aa', data.response.id);
5503
+ assert.equal('Example batch job', data.response.name);
5504
+ assert.equal(10, data.response.total_items);
5505
+ assert.equal(3, data.response.failed_items);
5506
+ assert.equal(9, data.response.processing_time);
5507
+ assert.equal('example.admin', data.response.requested_by_name);
5508
+ assert.equal('Example description.', data.response.description);
5509
+ assert.equal(true, Array.isArray(data.response.emails));
5510
+ } else {
5511
+ runCommonAsserts(data, error);
5512
+ }
5513
+ saveMockData('ExternalBatchCertificateEnrollment', 'batchEnrollExternal', 'default', data);
5514
+ done();
5515
+ } catch (err) {
5516
+ log.error(`Test Failure: ${err}`);
5517
+ done(err);
5518
+ }
5519
+ });
5520
+ } catch (error) {
5521
+ log.error(`Adapter Exception: ${error}`);
5522
+ done(error);
5523
+ }
5524
+ }).timeout(attemptTimeout);
5525
+ });
5526
+
5527
+ describe('#downloadMapping - errors', () => {
5528
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5529
+ try {
5530
+ a.downloadMapping('fakedata', (data, error) => {
5531
+ try {
5532
+ if (stub) {
5533
+ const displayE = 'Error 400 received on request';
5534
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5535
+ } else {
5536
+ runCommonAsserts(data, error);
5537
+ }
5538
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadMapping', 'default', data);
5539
+ done();
5540
+ } catch (err) {
5541
+ log.error(`Test Failure: ${err}`);
5542
+ done(err);
5543
+ }
5544
+ });
5545
+ } catch (error) {
5546
+ log.error(`Adapter Exception: ${error}`);
5547
+ done(error);
5548
+ }
5549
+ }).timeout(attemptTimeout);
5550
+ });
5551
+
5552
+ describe('#downloadByJobIdAndUniqueId - errors', () => {
5553
+ it('should work if integrated or standalone with mockdata', (done) => {
5554
+ try {
5555
+ a.downloadByJobIdAndUniqueId('fakedata', 'fakedata', 'fakedata', (data, error) => {
5556
+ try {
5557
+ if (stub) {
5558
+ runCommonAsserts(data, error);
5559
+ assert.equal('b5db525b-fff8-44de-abab-fd4e8b68f2c5', data.response.certificate_id);
5560
+ assert.equal('string', data.response.certificate);
5561
+ assert.equal('string', data.response.private_key);
5562
+ assert.equal(true, Array.isArray(data.response.chain));
5563
+ assert.equal('<base64_encoded_PKCS12_file>', data.response.pkcs12);
5564
+ assert.equal('<passcode>', data.response.pkcs12_password);
5565
+ } else {
5566
+ runCommonAsserts(data, error);
5567
+ }
5568
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadByJobIdAndUniqueId', 'default', data);
5569
+ done();
5570
+ } catch (err) {
5571
+ log.error(`Test Failure: ${err}`);
5572
+ done(err);
5573
+ }
5574
+ });
5575
+ } catch (error) {
5576
+ log.error(`Adapter Exception: ${error}`);
5577
+ done(error);
5578
+ }
5579
+ }).timeout(attemptTimeout);
5580
+ });
5581
+
5582
+ describe('#downloadByCommonName - errors', () => {
5583
+ it('should work if integrated or standalone with mockdata', (done) => {
5584
+ try {
5585
+ a.downloadByCommonName('fakedata', 'fakedata', (data, error) => {
5586
+ try {
5587
+ if (stub) {
5588
+ runCommonAsserts(data, error);
5589
+ assert.equal('object', typeof data.response[0]);
5590
+ assert.equal('object', typeof data.response[1]);
5591
+ assert.equal('object', typeof data.response[2]);
5592
+ assert.equal('object', typeof data.response[3]);
5593
+ } else {
5594
+ runCommonAsserts(data, error);
5595
+ }
5596
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadByCommonName', 'default', data);
5597
+ done();
5598
+ } catch (err) {
5599
+ log.error(`Test Failure: ${err}`);
5600
+ done(err);
5601
+ }
5602
+ });
5603
+ } catch (error) {
5604
+ log.error(`Adapter Exception: ${error}`);
5605
+ done(error);
5606
+ }
5607
+ }).timeout(attemptTimeout);
5608
+ });
5609
+
5610
+ describe('#downloadByJobIdAndCommonName - errors', () => {
5611
+ it('should work if integrated or standalone with mockdata', (done) => {
5612
+ try {
5613
+ a.downloadByJobIdAndCommonName('fakedata', 'fakedata', 'fakedata', (data, error) => {
5614
+ try {
5615
+ if (stub) {
5616
+ runCommonAsserts(data, error);
5617
+ assert.equal('object', typeof data.response[0]);
5618
+ assert.equal('object', typeof data.response[1]);
5619
+ assert.equal('object', typeof data.response[2]);
5620
+ assert.equal('object', typeof data.response[3]);
5621
+ } else {
5622
+ runCommonAsserts(data, error);
5623
+ }
5624
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadByJobIdAndCommonName', 'default', data);
5625
+ done();
5626
+ } catch (err) {
5627
+ log.error(`Test Failure: ${err}`);
5628
+ done(err);
5629
+ }
5630
+ });
5631
+ } catch (error) {
5632
+ log.error(`Adapter Exception: ${error}`);
5633
+ done(error);
5634
+ }
5635
+ }).timeout(attemptTimeout);
5636
+ });
5637
+
5638
+ describe('#downloadByCertificateValue - errors', () => {
5639
+ it('should work if integrated or standalone with mockdata', (done) => {
5640
+ try {
5641
+ a.downloadByCertificateValue('fakedata', 'fakedata', (data, error) => {
5642
+ try {
5643
+ if (stub) {
5644
+ runCommonAsserts(data, error);
5645
+ assert.equal('object', typeof data.response[0]);
5646
+ assert.equal('object', typeof data.response[1]);
5647
+ assert.equal('object', typeof data.response[2]);
5648
+ assert.equal('object', typeof data.response[3]);
5649
+ } else {
5650
+ runCommonAsserts(data, error);
5651
+ }
5652
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadByCertificateValue', 'default', data);
5653
+ done();
5654
+ } catch (err) {
5655
+ log.error(`Test Failure: ${err}`);
5656
+ done(err);
5657
+ }
5658
+ });
5659
+ } catch (error) {
5660
+ log.error(`Adapter Exception: ${error}`);
5661
+ done(error);
5662
+ }
5663
+ }).timeout(attemptTimeout);
5664
+ });
5665
+
5666
+ describe('#downloadByJobIdAndCertificateValue - errors', () => {
5667
+ it('should work if integrated or standalone with mockdata', (done) => {
5668
+ try {
5669
+ a.downloadByJobIdAndCertificateValue('fakedata', 'fakedata', 'fakedata', (data, error) => {
5670
+ try {
5671
+ if (stub) {
5672
+ runCommonAsserts(data, error);
5673
+ assert.equal('object', typeof data.response[0]);
5674
+ } else {
5675
+ runCommonAsserts(data, error);
5676
+ }
5677
+ saveMockData('ExternalBatchCertificateEnrollment', 'downloadByJobIdAndCertificateValue', 'default', data);
5678
+ done();
5679
+ } catch (err) {
5680
+ log.error(`Test Failure: ${err}`);
5681
+ done(err);
5682
+ }
5683
+ });
5684
+ } catch (error) {
5685
+ log.error(`Adapter Exception: ${error}`);
5686
+ done(error);
5687
+ }
5688
+ }).timeout(attemptTimeout);
5689
+ });
5690
+
5691
+ const deviceProfilesCreateDeviceProfileBodyParam = {
5692
+ name: 'Example Device Profile',
5693
+ division_id: '618b1e36-665e-475a-85cc-e2ebc73633b2',
5694
+ fields: [
5695
+ {
5696
+ name: 'Optional custom field'
5697
+ }
5698
+ ]
5699
+ };
5700
+ describe('#createDeviceProfile - errors', () => {
5701
+ it('should work if integrated or standalone with mockdata', (done) => {
5702
+ try {
5703
+ a.createDeviceProfile(deviceProfilesCreateDeviceProfileBodyParam, (data, error) => {
5704
+ try {
5705
+ if (stub) {
5706
+ runCommonAsserts(data, error);
5707
+ assert.equal('dcfe811c-ecf1-4d2e-bf44-462963bc4ade', data.response.id);
5708
+ assert.equal('Device profile example', data.response.name);
5709
+ assert.equal('An example device profile', data.response.description);
5710
+ assert.equal('ACTIVE', data.response.status);
5711
+ assert.equal(true, data.response.device_api_allow_read);
5712
+ assert.equal(true, data.response.device_api_allow_write);
5713
+ assert.equal(true, data.response.device_api_allow_revoke);
5714
+ assert.equal(true, data.response.device_api_allow_renew_certificate);
5715
+ assert.equal(false, data.response.device_api_allow_enroll_certificate);
5716
+ assert.equal(true, Array.isArray(data.response.fields));
5717
+ assert.equal('object', typeof data.response.division);
5718
+ assert.equal('f92834ce-cdea-1584-b154-193bb198345e', data.response.account_id);
5719
+ } else {
5720
+ runCommonAsserts(data, error);
5721
+ }
5722
+ saveMockData('DeviceProfiles', 'createDeviceProfile', 'default', data);
5723
+ done();
5724
+ } catch (err) {
5725
+ log.error(`Test Failure: ${err}`);
5726
+ done(err);
5727
+ }
5728
+ });
5729
+ } catch (error) {
5730
+ log.error(`Adapter Exception: ${error}`);
5731
+ done(error);
5732
+ }
5733
+ }).timeout(attemptTimeout);
5734
+ });
5735
+
5736
+ describe('#listdeviceprofiles - errors', () => {
5737
+ it('should work if integrated or standalone with mockdata', (done) => {
5738
+ try {
5739
+ a.listdeviceprofiles(null, null, null, null, null, null, (data, error) => {
5740
+ try {
5741
+ if (stub) {
5742
+ runCommonAsserts(data, error);
5743
+ assert.equal(20, data.response.limit);
5744
+ assert.equal(0, data.response.offset);
5745
+ assert.equal(true, data.response.pagination);
5746
+ assert.equal(false, data.response.next);
5747
+ assert.equal(2, data.response.total);
5748
+ assert.equal(true, Array.isArray(data.response.records));
5749
+ } else {
5750
+ runCommonAsserts(data, error);
5751
+ }
5752
+ saveMockData('DeviceProfiles', 'listdeviceprofiles', 'default', data);
5753
+ done();
5754
+ } catch (err) {
5755
+ log.error(`Test Failure: ${err}`);
5756
+ done(err);
5757
+ }
5758
+ });
5759
+ } catch (error) {
5760
+ log.error(`Adapter Exception: ${error}`);
5761
+ done(error);
5762
+ }
5763
+ }).timeout(attemptTimeout);
5764
+ });
5765
+
5766
+ describe('#getDeviceProfile - errors', () => {
5767
+ it('should work if integrated or standalone with mockdata', (done) => {
5768
+ try {
5769
+ a.getDeviceProfile('fakedata', (data, error) => {
5770
+ try {
5771
+ if (stub) {
5772
+ runCommonAsserts(data, error);
5773
+ assert.equal('dcfe811c-ecf1-4d2e-bf44-462963bc4ade', data.response.id);
5774
+ assert.equal('Device profile example', data.response.name);
5775
+ assert.equal('An example device profile', data.response.description);
5776
+ assert.equal('ACTIVE', data.response.status);
5777
+ assert.equal(true, data.response.device_api_allow_read);
5778
+ assert.equal(true, data.response.device_api_allow_write);
5779
+ assert.equal(true, data.response.device_api_allow_revoke);
5780
+ assert.equal(true, data.response.device_api_allow_renew_certificate);
5781
+ assert.equal(false, data.response.device_api_allow_enroll_certificate);
5782
+ assert.equal(true, Array.isArray(data.response.fields));
5783
+ assert.equal('object', typeof data.response.division);
5784
+ assert.equal('f92834ce-cdea-1584-b154-193bb198345e', data.response.account_id);
5785
+ } else {
5786
+ runCommonAsserts(data, error);
5787
+ }
5788
+ saveMockData('DeviceProfiles', 'getDeviceProfile', 'default', data);
5789
+ done();
5790
+ } catch (err) {
5791
+ log.error(`Test Failure: ${err}`);
5792
+ done(err);
5793
+ }
5794
+ });
5795
+ } catch (error) {
5796
+ log.error(`Adapter Exception: ${error}`);
5797
+ done(error);
5798
+ }
5799
+ }).timeout(attemptTimeout);
5800
+ });
5801
+
5802
+ const deviceProfilesUpdateDeviceProfileBodyParam = {
5803
+ name: 'Example Device Profile',
5804
+ division_id: '618b1e36-665e-475a-85cc-e2ebc73633b2',
5805
+ fields: [
5806
+ {
5807
+ name: 'Optional custom field'
5808
+ }
5809
+ ]
5810
+ };
5811
+ describe('#updateDeviceProfile - errors', () => {
5812
+ it('should work if integrated or standalone with mockdata', (done) => {
5813
+ try {
5814
+ a.updateDeviceProfile('fakedata', deviceProfilesUpdateDeviceProfileBodyParam, (data, error) => {
5815
+ try {
5816
+ if (stub) {
5817
+ runCommonAsserts(data, error);
5818
+ assert.equal('success', data.response);
5819
+ } else {
5820
+ runCommonAsserts(data, error);
5821
+ }
5822
+ saveMockData('DeviceProfiles', 'updateDeviceProfile', 'default', data);
5823
+ done();
5824
+ } catch (err) {
5825
+ log.error(`Test Failure: ${err}`);
5826
+ done(err);
5827
+ }
5828
+ });
5829
+ } catch (error) {
5830
+ log.error(`Adapter Exception: ${error}`);
5831
+ done(error);
5832
+ }
5833
+ }).timeout(attemptTimeout);
5834
+ });
5835
+
5836
+ describe('#deleteDeviceProfile - errors', () => {
5837
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5838
+ try {
5839
+ a.deleteDeviceProfile('fakedata', (data, error) => {
5840
+ try {
5841
+ if (stub) {
5842
+ const displayE = 'Error 400 received on request';
5843
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5844
+ } else {
5845
+ runCommonAsserts(data, error);
5846
+ }
5847
+ saveMockData('DeviceProfiles', 'deleteDeviceProfile', 'default', data);
5848
+ done();
5849
+ } catch (err) {
5850
+ log.error(`Test Failure: ${err}`);
5851
+ done(err);
5852
+ }
5853
+ });
5854
+ } catch (error) {
5855
+ log.error(`Adapter Exception: ${error}`);
5856
+ done(error);
5857
+ }
5858
+ }).timeout(attemptTimeout);
5859
+ });
5860
+
5861
+ describe('#restoreDeviceProfile - errors', () => {
5862
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5863
+ try {
5864
+ a.restoreDeviceProfile('fakedata', (data, error) => {
5865
+ try {
5866
+ if (stub) {
5867
+ const displayE = 'Error 400 received on request';
5868
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5869
+ } else {
5870
+ runCommonAsserts(data, error);
5871
+ }
5872
+ saveMockData('DeviceProfiles', 'restoreDeviceProfile', 'default', data);
5873
+ done();
5874
+ } catch (err) {
5875
+ log.error(`Test Failure: ${err}`);
5876
+ done(err);
5877
+ }
5878
+ });
5879
+ } catch (error) {
5880
+ log.error(`Adapter Exception: ${error}`);
5881
+ done(error);
5882
+ }
5883
+ }).timeout(attemptTimeout);
5884
+ });
5885
+
5886
+ describe('#getICA - errors', () => {
5887
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5888
+ try {
5889
+ a.getICA('fakedata', (data, error) => {
5890
+ try {
5891
+ if (stub) {
5892
+ const displayE = 'Error 400 received on request';
5893
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5894
+ } else {
5895
+ runCommonAsserts(data, error);
5896
+ }
5897
+ saveMockData('ICAs', 'getICA', 'default', data);
5898
+ done();
5899
+ } catch (err) {
5900
+ log.error(`Test Failure: ${err}`);
5901
+ done(err);
5902
+ }
5903
+ });
5904
+ } catch (error) {
5905
+ log.error(`Adapter Exception: ${error}`);
5906
+ done(error);
5907
+ }
5908
+ }).timeout(attemptTimeout);
5909
+ });
5910
+
5911
+ describe('#listICAs - errors', () => {
5912
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5913
+ try {
5914
+ a.listICAs(null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
5915
+ try {
5916
+ if (stub) {
5917
+ const displayE = 'Error 400 received on request';
5918
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5919
+ } else {
5920
+ runCommonAsserts(data, error);
5921
+ }
5922
+ saveMockData('ICAs', 'listICAs', 'default', data);
5923
+ done();
5924
+ } catch (err) {
5925
+ log.error(`Test Failure: ${err}`);
5926
+ done(err);
5927
+ }
5928
+ });
5929
+ } catch (error) {
5930
+ log.error(`Adapter Exception: ${error}`);
5931
+ done(error);
5932
+ }
5933
+ }).timeout(attemptTimeout);
5934
+ });
5935
+
5936
+ describe('#getGatewayDetails - errors', () => {
5937
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5938
+ try {
5939
+ a.getGatewayDetails('fakedata', (data, error) => {
5940
+ try {
5941
+ if (stub) {
5942
+ const displayE = 'Error 400 received on request';
5943
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5944
+ } else {
5945
+ runCommonAsserts(data, error);
5946
+ }
5947
+ saveMockData('Gateways', 'getGatewayDetails', 'default', data);
5948
+ done();
5949
+ } catch (err) {
5950
+ log.error(`Test Failure: ${err}`);
5951
+ done(err);
5952
+ }
5953
+ });
5954
+ } catch (error) {
5955
+ log.error(`Adapter Exception: ${error}`);
5956
+ done(error);
5957
+ }
5958
+ }).timeout(attemptTimeout);
5959
+ });
5960
+
5961
+ const gatewaysUpdateGatewayBodyParam = {
5962
+ account_id: '1331f16c-7e4e-4e5e-9187-27f951d46924',
5963
+ name: 'Example gateway',
5964
+ mac_address: 'gg-hh-ii-kk-ll-mm',
5965
+ http_enabled: false,
5966
+ http_port: '8080',
5967
+ ssl_enabled: true,
5968
+ ssl_port: '8443',
5969
+ ssl_certificate_pkcs12_file_path: 'config/gateway.p12',
5970
+ ssl_certificate_pkcs12_key_store_password: '********rd',
5971
+ use_authentication_api_token: true,
5972
+ authentication_api_token: '********1234',
5973
+ use_authentication_certificate: false,
5974
+ authentication_certificate_pkcs12: '<auth_cert_pkcs12>',
5975
+ authentication_certificate_pkcs12_password: '********123'
5976
+ };
5977
+ describe('#updateGateway - errors', () => {
5978
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
5979
+ try {
5980
+ a.updateGateway('fakedata', gatewaysUpdateGatewayBodyParam, (data, error) => {
5981
+ try {
5982
+ if (stub) {
5983
+ const displayE = 'Error 400 received on request';
5984
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
5985
+ } else {
5986
+ runCommonAsserts(data, error);
5987
+ }
5988
+ saveMockData('Gateways', 'updateGateway', 'default', data);
5989
+ done();
5990
+ } catch (err) {
5991
+ log.error(`Test Failure: ${err}`);
5992
+ done(err);
5993
+ }
5994
+ });
5995
+ } catch (error) {
5996
+ log.error(`Adapter Exception: ${error}`);
5997
+ done(error);
5998
+ }
5999
+ }).timeout(attemptTimeout);
6000
+ });
6001
+
6002
+ describe('#listGateways - errors', () => {
6003
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6004
+ try {
6005
+ a.listGateways(null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
6006
+ try {
6007
+ if (stub) {
6008
+ const displayE = 'Error 400 received on request';
6009
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6010
+ } else {
6011
+ runCommonAsserts(data, error);
6012
+ }
6013
+ saveMockData('Gateways', 'listGateways', 'default', data);
6014
+ done();
6015
+ } catch (err) {
6016
+ log.error(`Test Failure: ${err}`);
6017
+ done(err);
6018
+ }
6019
+ });
6020
+ } catch (error) {
6021
+ log.error(`Adapter Exception: ${error}`);
6022
+ done(error);
6023
+ }
6024
+ }).timeout(attemptTimeout);
6025
+ });
6026
+
6027
+ const gatewaysCreateGatewayBodyParam = {
6028
+ account_id: '1331f16c-7e4e-4e5e-9187-27f951d46924',
6029
+ name: 'Example gateway',
6030
+ mac_address: 'gg-hh-ii-kk-ll-mm',
6031
+ http_enabled: false,
6032
+ http_port: '8080',
6033
+ ssl_enabled: false,
6034
+ ssl_port: '8443',
6035
+ ssl_certificate_pkcs12_file_path: 'config/gateway.p12',
6036
+ ssl_certificate_pkcs12_key_store_password: '********rd',
6037
+ use_authentication_api_token: false,
6038
+ authentication_api_token: '********1234',
6039
+ use_authentication_certificate: false,
6040
+ authentication_certificate_pkcs12: '<auth_cert_pkcs12>',
6041
+ authentication_certificate_pkcs12_password: '********123'
6042
+ };
6043
+ describe('#createGateway - errors', () => {
6044
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6045
+ try {
6046
+ a.createGateway(gatewaysCreateGatewayBodyParam, (data, error) => {
6047
+ try {
6048
+ if (stub) {
6049
+ const displayE = 'Error 400 received on request';
6050
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6051
+ } else {
6052
+ runCommonAsserts(data, error);
6053
+ }
6054
+ saveMockData('Gateways', 'createGateway', 'default', data);
6055
+ done();
6056
+ } catch (err) {
6057
+ log.error(`Test Failure: ${err}`);
6058
+ done(err);
6059
+ }
6060
+ });
6061
+ } catch (error) {
6062
+ log.error(`Adapter Exception: ${error}`);
6063
+ done(error);
6064
+ }
6065
+ }).timeout(attemptTimeout);
6066
+ });
6067
+
6068
+ describe('#enableGateway - errors', () => {
6069
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6070
+ try {
6071
+ a.enableGateway('fakedata', (data, error) => {
6072
+ try {
6073
+ if (stub) {
6074
+ const displayE = 'Error 400 received on request';
6075
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6076
+ } else {
6077
+ runCommonAsserts(data, error);
6078
+ }
6079
+ saveMockData('Gateways', 'enableGateway', 'default', data);
6080
+ done();
6081
+ } catch (err) {
6082
+ log.error(`Test Failure: ${err}`);
6083
+ done(err);
6084
+ }
6085
+ });
6086
+ } catch (error) {
6087
+ log.error(`Adapter Exception: ${error}`);
6088
+ done(error);
6089
+ }
6090
+ }).timeout(attemptTimeout);
6091
+ });
6092
+
6093
+ describe('#disableGateway - errors', () => {
6094
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6095
+ try {
6096
+ a.disableGateway('fakedata', (data, error) => {
6097
+ try {
6098
+ if (stub) {
6099
+ const displayE = 'Error 400 received on request';
6100
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6101
+ } else {
6102
+ runCommonAsserts(data, error);
6103
+ }
6104
+ saveMockData('Gateways', 'disableGateway', 'default', data);
6105
+ done();
6106
+ } catch (err) {
6107
+ log.error(`Test Failure: ${err}`);
6108
+ done(err);
6109
+ }
6110
+ });
6111
+ } catch (error) {
6112
+ log.error(`Adapter Exception: ${error}`);
6113
+ done(error);
6114
+ }
6115
+ }).timeout(attemptTimeout);
6116
+ });
6117
+
6118
+ describe('#deleteGateway - errors', () => {
6119
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6120
+ try {
6121
+ a.deleteGateway('fakedata', (data, error) => {
6122
+ try {
6123
+ if (stub) {
6124
+ const displayE = 'Error 400 received on request';
6125
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6126
+ } else {
6127
+ runCommonAsserts(data, error);
6128
+ }
6129
+ saveMockData('Gateways', 'deleteGateway', 'default', data);
6130
+ done();
6131
+ } catch (err) {
6132
+ log.error(`Test Failure: ${err}`);
6133
+ done(err);
6134
+ }
6135
+ });
6136
+ } catch (error) {
6137
+ log.error(`Adapter Exception: ${error}`);
6138
+ done(error);
6139
+ }
6140
+ }).timeout(attemptTimeout);
6141
+ });
6142
+
6143
+ describe('#restoreGateway - errors', () => {
6144
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6145
+ try {
6146
+ a.restoreGateway('fakedata', (data, error) => {
6147
+ try {
6148
+ if (stub) {
6149
+ const displayE = 'Error 400 received on request';
6150
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6151
+ } else {
6152
+ runCommonAsserts(data, error);
6153
+ }
6154
+ saveMockData('Gateways', 'restoreGateway', 'default', data);
6155
+ done();
6156
+ } catch (err) {
6157
+ log.error(`Test Failure: ${err}`);
6158
+ done(err);
6159
+ }
6160
+ });
6161
+ } catch (error) {
6162
+ log.error(`Adapter Exception: ${error}`);
6163
+ done(error);
6164
+ }
6165
+ }).timeout(attemptTimeout);
6166
+ });
6167
+
6168
+ describe('#downloadGatewayConfig - errors', () => {
6169
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6170
+ try {
6171
+ a.downloadGatewayConfig('fakedata', (data, error) => {
6172
+ try {
6173
+ if (stub) {
6174
+ const displayE = 'Error 400 received on request';
6175
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6176
+ } else {
6177
+ runCommonAsserts(data, error);
6178
+ }
6179
+ saveMockData('Gateways', 'downloadGatewayConfig', 'default', data);
6180
+ done();
6181
+ } catch (err) {
6182
+ log.error(`Test Failure: ${err}`);
6183
+ done(err);
6184
+ }
6185
+ });
6186
+ } catch (error) {
6187
+ log.error(`Adapter Exception: ${error}`);
6188
+ done(error);
6189
+ }
6190
+ }).timeout(attemptTimeout);
6191
+ });
6192
+
6193
+ describe('#listOCSPGroups - errors', () => {
6194
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6195
+ try {
6196
+ a.listOCSPGroups(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
6197
+ try {
6198
+ if (stub) {
6199
+ const displayE = 'Error 400 received on request';
6200
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6201
+ } else {
6202
+ runCommonAsserts(data, error);
6203
+ }
6204
+ saveMockData('OCSPGroups', 'listOCSPGroups', 'default', data);
6205
+ done();
6206
+ } catch (err) {
6207
+ log.error(`Test Failure: ${err}`);
6208
+ done(err);
6209
+ }
6210
+ });
6211
+ } catch (error) {
6212
+ log.error(`Adapter Exception: ${error}`);
6213
+ done(error);
6214
+ }
6215
+ }).timeout(attemptTimeout);
6216
+ });
6217
+
6218
+ const oCSPGroupsCreateOCSPGroupBodyParam = {
6219
+ name: 'Example OCSP group',
6220
+ certificates: [
6221
+ '81133e8f-6b0d-4bf1-ac9e-402e72e006b0',
6222
+ '6ef9246f-e071-4a8e-a871-0ea4314cde64',
6223
+ '5be444dd-ea46-4cac-9e15-823d16012c69'
6224
+ ],
6225
+ division_id: '3f8f4482-1e31-4840-831e-9416b1dec1f5'
6226
+ };
6227
+ describe('#createOCSPGroup - errors', () => {
6228
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6229
+ try {
6230
+ a.createOCSPGroup(oCSPGroupsCreateOCSPGroupBodyParam, (data, error) => {
6231
+ try {
6232
+ if (stub) {
6233
+ const displayE = 'Error 400 received on request';
6234
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6235
+ } else {
6236
+ runCommonAsserts(data, error);
6237
+ }
6238
+ saveMockData('OCSPGroups', 'createOCSPGroup', 'default', data);
6239
+ done();
6240
+ } catch (err) {
6241
+ log.error(`Test Failure: ${err}`);
6242
+ done(err);
6243
+ }
6244
+ });
6245
+ } catch (error) {
6246
+ log.error(`Adapter Exception: ${error}`);
6247
+ done(error);
6248
+ }
6249
+ }).timeout(attemptTimeout);
6250
+ });
6251
+
6252
+ describe('#getOCSPGroupDetails - errors', () => {
6253
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6254
+ try {
6255
+ a.getOCSPGroupDetails('fakedata', (data, error) => {
6256
+ try {
6257
+ if (stub) {
6258
+ const displayE = 'Error 400 received on request';
6259
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6260
+ } else {
6261
+ runCommonAsserts(data, error);
6262
+ }
6263
+ saveMockData('OCSPGroups', 'getOCSPGroupDetails', 'default', data);
6264
+ done();
6265
+ } catch (err) {
6266
+ log.error(`Test Failure: ${err}`);
6267
+ done(err);
6268
+ }
6269
+ });
6270
+ } catch (error) {
6271
+ log.error(`Adapter Exception: ${error}`);
6272
+ done(error);
6273
+ }
6274
+ }).timeout(attemptTimeout);
6275
+ });
6276
+
6277
+ const oCSPGroupsUpdateOCSPGroupBodyParam = {
6278
+ name: 'Updated OCSP group'
6279
+ };
6280
+ describe('#updateOCSPGroup - errors', () => {
6281
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6282
+ try {
6283
+ a.updateOCSPGroup('fakedata', oCSPGroupsUpdateOCSPGroupBodyParam, (data, error) => {
6284
+ try {
6285
+ if (stub) {
6286
+ const displayE = 'Error 400 received on request';
6287
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6288
+ } else {
6289
+ runCommonAsserts(data, error);
6290
+ }
6291
+ saveMockData('OCSPGroups', 'updateOCSPGroup', 'default', data);
6292
+ done();
6293
+ } catch (err) {
6294
+ log.error(`Test Failure: ${err}`);
6295
+ done(err);
6296
+ }
6297
+ });
6298
+ } catch (error) {
6299
+ log.error(`Adapter Exception: ${error}`);
6300
+ done(error);
6301
+ }
6302
+ }).timeout(attemptTimeout);
6303
+ });
6304
+
6305
+ describe('#deleteOCSPGroup - errors', () => {
6306
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6307
+ try {
6308
+ a.deleteOCSPGroup('fakedata', (data, error) => {
6309
+ try {
6310
+ if (stub) {
6311
+ const displayE = 'Error 400 received on request';
6312
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6313
+ } else {
6314
+ runCommonAsserts(data, error);
6315
+ }
6316
+ saveMockData('OCSPGroups', 'deleteOCSPGroup', 'default', data);
6317
+ done();
6318
+ } catch (err) {
6319
+ log.error(`Test Failure: ${err}`);
6320
+ done(err);
6321
+ }
6322
+ });
6323
+ } catch (error) {
6324
+ log.error(`Adapter Exception: ${error}`);
6325
+ done(error);
6326
+ }
6327
+ }).timeout(attemptTimeout);
6328
+ });
6329
+
6330
+ const oCSPGroupsAddCertsOCSPGroupBodyParam = [
6331
+ 'string'
6332
+ ];
6333
+ describe('#addCertsOCSPGroup - errors', () => {
6334
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6335
+ try {
6336
+ a.addCertsOCSPGroup('fakedata', oCSPGroupsAddCertsOCSPGroupBodyParam, (data, error) => {
6337
+ try {
6338
+ if (stub) {
6339
+ const displayE = 'Error 400 received on request';
6340
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6341
+ } else {
6342
+ runCommonAsserts(data, error);
6343
+ }
6344
+ saveMockData('OCSPGroups', 'addCertsOCSPGroup', 'default', data);
6345
+ done();
6346
+ } catch (err) {
6347
+ log.error(`Test Failure: ${err}`);
6348
+ done(err);
6349
+ }
6350
+ });
6351
+ } catch (error) {
6352
+ log.error(`Adapter Exception: ${error}`);
6353
+ done(error);
6354
+ }
6355
+ }).timeout(attemptTimeout);
6356
+ });
6357
+
6358
+ const oCSPGroupsRemoveCertsOCSPGroupBodyParam = [
6359
+ 'string'
6360
+ ];
6361
+ describe('#removeCertsOCSPGroup - errors', () => {
6362
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6363
+ try {
6364
+ a.removeCertsOCSPGroup('fakedata', oCSPGroupsRemoveCertsOCSPGroupBodyParam, (data, error) => {
6365
+ try {
6366
+ if (stub) {
6367
+ const displayE = 'Error 400 received on request';
6368
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6369
+ } else {
6370
+ runCommonAsserts(data, error);
6371
+ }
6372
+ saveMockData('OCSPGroups', 'removeCertsOCSPGroup', 'default', data);
6373
+ done();
6374
+ } catch (err) {
6375
+ log.error(`Test Failure: ${err}`);
6376
+ done(err);
6377
+ }
6378
+ });
6379
+ } catch (error) {
6380
+ log.error(`Adapter Exception: ${error}`);
6381
+ done(error);
6382
+ }
6383
+ }).timeout(attemptTimeout);
6384
+ });
6385
+
6386
+ describe('#listOCSPGroupCerts - errors', () => {
6387
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
6388
+ try {
6389
+ a.listOCSPGroupCerts('fakedata', null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, (data, error) => {
6390
+ try {
6391
+ if (stub) {
6392
+ const displayE = 'Error 400 received on request';
6393
+ runErrorAsserts(data, error, 'AD.500', 'Test-digicert-connectorRest-handleEndResponse', displayE);
6394
+ } else {
6395
+ runCommonAsserts(data, error);
6396
+ }
6397
+ saveMockData('OCSPGroups', 'listOCSPGroupCerts', 'default', data);
6398
+ done();
6399
+ } catch (err) {
6400
+ log.error(`Test Failure: ${err}`);
6401
+ done(err);
6402
+ }
6403
+ });
6404
+ } catch (error) {
6405
+ log.error(`Adapter Exception: ${error}`);
6406
+ done(error);
6407
+ }
6408
+ }).timeout(attemptTimeout);
6409
+ });
1866
6410
  });
1867
6411
  });