@webex/internal-plugin-ediscovery 2.37.0 → 2.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -6
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/ediscovery-error.js +2 -24
- package/dist/ediscovery-error.js.map +1 -1
- package/dist/ediscovery.js +236 -370
- package/dist/ediscovery.js.map +1 -1
- package/dist/index.js +4 -28
- package/dist/index.js.map +1 -1
- package/dist/report-request.js +0 -6
- package/dist/report-request.js.map +1 -1
- package/dist/retry.js +27 -43
- package/dist/retry.js.map +1 -1
- package/dist/transforms.js +58 -104
- package/dist/transforms.js.map +1 -1
- package/package.json +10 -10
- package/src/config.js +6 -4
- package/src/index.js +35 -22
- package/src/report-request.js +10 -1
- package/src/retry.js +23 -14
- package/src/transforms.js +460 -217
- package/test/integration/spec/ediscovery.js +62 -43
- package/test/unit/spec/content.js +304 -166
- package/test/unit/spec/report.js +76 -77
- package/test/unit/spec/transforms.js +168 -156
|
@@ -22,7 +22,7 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
22
22
|
ctx.webex.config.ediscovery = config.ediscovery;
|
|
23
23
|
ctx.webex.internal = {
|
|
24
24
|
device: {
|
|
25
|
-
deviceType: 'FAKE_DEVICE'
|
|
25
|
+
deviceType: 'FAKE_DEVICE',
|
|
26
26
|
},
|
|
27
27
|
encryption: {
|
|
28
28
|
encryptText: sinon.stub().returns(Promise.resolve(encryptedText)),
|
|
@@ -30,9 +30,9 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
30
30
|
decryptScr: sinon.stub().returns(Promise.resolve(decryptedScr)),
|
|
31
31
|
kms: {
|
|
32
32
|
createUnboundKeys: sinon.stub().returns(Promise.resolve([{userIds: uuid, uri: keyUri}])),
|
|
33
|
-
createResource: sinon.stub().returns(Promise.resolve())
|
|
34
|
-
}
|
|
35
|
-
}
|
|
33
|
+
createResource: sinon.stub().returns(Promise.resolve()),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -61,21 +61,20 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
61
61
|
it('Calls the correct encrypt functions when transforming a report request', () => {
|
|
62
62
|
// body IS a ReportRequest
|
|
63
63
|
object = {body: reportRequest};
|
|
64
|
-
const result = Transforms.encryptReportRequest(ctx, object)
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
64
|
+
const result = Transforms.encryptReportRequest(ctx, object).then(() => {
|
|
65
|
+
assert.callCount(ctx.webex.internal.encryption.encryptText, 4);
|
|
66
|
+
assert.equal(reportRequest.name, encryptedText);
|
|
67
|
+
assert.equal(reportRequest.description, '');
|
|
68
|
+
assert.equal(reportRequest.spaceNames[0], encryptedText);
|
|
69
|
+
assert.equal(reportRequest.emails[0], encryptedText);
|
|
70
|
+
assert.equal(reportRequest.emails[1], encryptedText);
|
|
71
|
+
// unencryptedEmails should be copied from emails before decryption
|
|
72
|
+
assert.equal(reportRequest.unencryptedEmails[0], 'email1@test.com');
|
|
73
|
+
assert.equal(reportRequest.unencryptedEmails[1], 'email2@test.com');
|
|
74
|
+
assert.empty(reportRequest.keywords);
|
|
75
|
+
// this should be populated by request to kms
|
|
76
|
+
assert.notEqual(reportRequest.encryptionKeyUrl, '');
|
|
77
|
+
});
|
|
79
78
|
|
|
80
79
|
return result;
|
|
81
80
|
});
|
|
@@ -87,16 +86,15 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
87
86
|
object = {body: {reportRequest}};
|
|
88
87
|
// object to be decrypted must have an encryption key
|
|
89
88
|
reportRequest.encryptionKeyUrl = keyUri;
|
|
90
|
-
const result = Transforms.decryptReportRequest(ctx, object)
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
89
|
+
const result = Transforms.decryptReportRequest(ctx, object).then(() => {
|
|
90
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 4);
|
|
91
|
+
assert.equal(reportRequest.name, decryptedText);
|
|
92
|
+
assert.equal(reportRequest.description, '');
|
|
93
|
+
assert.equal(reportRequest.spaceNames[0], decryptedText);
|
|
94
|
+
assert.equal(reportRequest.emails[0], decryptedText);
|
|
95
|
+
assert.equal(reportRequest.emails[1], decryptedText);
|
|
96
|
+
assert.empty(reportRequest.keywords);
|
|
97
|
+
});
|
|
100
98
|
|
|
101
99
|
return result;
|
|
102
100
|
});
|
|
@@ -104,10 +102,9 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
104
102
|
it('Does not attempt to decrypt a report request if there is no encryption key url', () => {
|
|
105
103
|
// body CONTAINS a ReportRequest
|
|
106
104
|
object = {body: {reportRequest}};
|
|
107
|
-
const result = Transforms.decryptReportRequest(ctx, object)
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
});
|
|
105
|
+
const result = Transforms.decryptReportRequest(ctx, object).then(() => {
|
|
106
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
107
|
+
});
|
|
111
108
|
|
|
112
109
|
return result;
|
|
113
110
|
});
|
|
@@ -136,27 +133,41 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
136
133
|
contentContainer.containerId = '0';
|
|
137
134
|
contentContainer.containerName = 'spaceName';
|
|
138
135
|
contentContainer.isOneOnOne = false;
|
|
139
|
-
contentContainer.participants = [
|
|
136
|
+
contentContainer.participants = [
|
|
137
|
+
{id: uuid, displayName: 'user1'},
|
|
138
|
+
{id: uuid, displayName: 'user2'},
|
|
139
|
+
{id: uuid, displayName: 'user3'},
|
|
140
|
+
];
|
|
140
141
|
contentContainer.onBehalfOfUser = uuid;
|
|
141
142
|
contentContainer.encryptionKeyUrl = keyUri;
|
|
142
143
|
|
|
143
|
-
ctx.webex.internal.ediscovery = {
|
|
144
|
+
ctx.webex.internal.ediscovery = {
|
|
145
|
+
getContentContainerByContainerId: sinon
|
|
146
|
+
.stub()
|
|
147
|
+
.returns(Promise.resolve({body: contentContainer})),
|
|
148
|
+
};
|
|
144
149
|
});
|
|
145
150
|
|
|
146
|
-
afterEach(() =>
|
|
151
|
+
afterEach(() =>
|
|
152
|
+
ctx.webex.internal.ediscovery.getContentContainerByContainerId.resetHistory()
|
|
153
|
+
);
|
|
147
154
|
|
|
148
155
|
it('Calls the decrypt functions when extension type is customApp', () => {
|
|
149
156
|
object.body.extension = {
|
|
150
|
-
objectType: 'extension',
|
|
157
|
+
objectType: 'extension',
|
|
158
|
+
extensionType: 'customApp',
|
|
159
|
+
contentUrl: 'encrypted content',
|
|
160
|
+
displayName: 'encrypted content',
|
|
161
|
+
webUrl: 'encrypted content',
|
|
162
|
+
appId: uuid,
|
|
151
163
|
};
|
|
152
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
153
|
-
.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
});
|
|
164
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
165
|
+
assert.equal(object.body.extension.contentUrl, decryptedText);
|
|
166
|
+
assert.equal(object.body.extension.webUrl, decryptedText);
|
|
167
|
+
assert.equal(object.body.extension.appId, uuid);
|
|
168
|
+
assert.equal(object.body.extension.displayName, decryptedText);
|
|
169
|
+
assert.equal(activity.error, undefined);
|
|
170
|
+
});
|
|
160
171
|
|
|
161
172
|
return result;
|
|
162
173
|
});
|
|
@@ -164,26 +175,28 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
164
175
|
it('Calls the decrypt functions when extension type is customApp along with the verb is update', () => {
|
|
165
176
|
object.body.verb = 'update';
|
|
166
177
|
object.body.extension = {
|
|
167
|
-
objectType: 'extension',
|
|
178
|
+
objectType: 'extension',
|
|
179
|
+
extensionType: 'customApp',
|
|
180
|
+
contentUrl: 'encrypted content',
|
|
181
|
+
displayName: 'encrypted content',
|
|
182
|
+
previous: {contentUrl: 'encrypted content', displayName: 'encrypted content'},
|
|
168
183
|
};
|
|
169
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
170
|
-
.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
184
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
185
|
+
assert.equal(object.body.extension.contentUrl, decryptedText);
|
|
186
|
+
assert.equal(object.body.extension.displayName, decryptedText);
|
|
187
|
+
assert.equal(object.body.extension.previous.contentUrl, decryptedText);
|
|
188
|
+
assert.equal(object.body.extension.previous.displayName, decryptedText);
|
|
189
|
+
assert.equal(activity.error, undefined);
|
|
190
|
+
});
|
|
177
191
|
|
|
178
192
|
return result;
|
|
179
193
|
});
|
|
180
194
|
|
|
181
195
|
it('Calls the correct decrypt functions when transforming post activities', () => {
|
|
182
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
183
|
-
.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
196
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
197
|
+
assert.equal(activity.objectDisplayName, decryptedText);
|
|
198
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
199
|
+
});
|
|
187
200
|
|
|
188
201
|
return result;
|
|
189
202
|
});
|
|
@@ -191,14 +204,16 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
191
204
|
it('Creates spaceName from participantDisplayNames for one to one spaces', () => {
|
|
192
205
|
contentContainer.isOneOnOne = true;
|
|
193
206
|
// one to one conversations have only 2 participants
|
|
194
|
-
contentContainer.participants = [
|
|
207
|
+
contentContainer.participants = [
|
|
208
|
+
{id: uuid, displayName: 'user1'},
|
|
209
|
+
{id: uuid, displayName: 'user2'},
|
|
210
|
+
];
|
|
195
211
|
// spacename should be undefined for one on one conversations
|
|
196
212
|
contentContainer.containerName = undefined;
|
|
197
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
198
|
-
.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
});
|
|
213
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
214
|
+
assert.equal(activity.objectDisplayName, decryptedText);
|
|
215
|
+
assert.equal(activity.spaceName, 'user1 & user2');
|
|
216
|
+
});
|
|
202
217
|
|
|
203
218
|
return result;
|
|
204
219
|
});
|
|
@@ -207,12 +222,11 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
207
222
|
object.body.verb = 'add';
|
|
208
223
|
// object display name for add activity is a uuid
|
|
209
224
|
object.body.objectDisplayName = uuid;
|
|
210
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
211
|
-
.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
225
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
226
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
227
|
+
assert.equal(activity.objectDisplayName, uuid);
|
|
228
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
229
|
+
});
|
|
216
230
|
|
|
217
231
|
return result;
|
|
218
232
|
});
|
|
@@ -221,66 +235,63 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
221
235
|
object.body.verb = 'leave';
|
|
222
236
|
// object display name for leave activity is a uuid
|
|
223
237
|
object.body.objectDisplayName = uuid;
|
|
224
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
225
|
-
.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
});
|
|
238
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
239
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
240
|
+
assert.equal(activity.objectDisplayName, uuid);
|
|
241
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
242
|
+
});
|
|
230
243
|
|
|
231
244
|
return result;
|
|
232
245
|
});
|
|
233
246
|
|
|
234
247
|
it('Does not call any decrypt functions if encryption key url is empty', () => {
|
|
235
248
|
object.body.encryptionKeyUrl = '';
|
|
236
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
237
|
-
.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
});
|
|
249
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
250
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
251
|
+
assert.equal(activity.objectDisplayName, 'encrypted content');
|
|
252
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
253
|
+
});
|
|
242
254
|
|
|
243
255
|
return result;
|
|
244
256
|
});
|
|
245
257
|
|
|
246
258
|
it('Does not call any decrypt functions if encryption key url is undefined', () => {
|
|
247
259
|
object.body.encryptionKeyUrl = undefined;
|
|
248
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
249
|
-
.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
260
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
261
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
262
|
+
assert.equal(activity.objectDisplayName, 'encrypted content');
|
|
263
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
264
|
+
});
|
|
254
265
|
|
|
255
266
|
return result;
|
|
256
267
|
});
|
|
257
268
|
|
|
258
269
|
it('Does not call any decrypt functions if onBehalfOfUser is empty', () => {
|
|
259
270
|
contentContainer.onBehalfOfUser = '';
|
|
260
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
261
|
-
.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
});
|
|
271
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
272
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
273
|
+
assert.equal(activity.objectDisplayName, 'encrypted content');
|
|
274
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
275
|
+
});
|
|
266
276
|
|
|
267
277
|
return result;
|
|
268
278
|
});
|
|
269
279
|
|
|
270
280
|
it('Does not call any decrypt functions if onBehalfOfUser is undefined', () => {
|
|
271
281
|
contentContainer.onBehalfOfUser = undefined;
|
|
272
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
273
|
-
.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
282
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
283
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 0);
|
|
284
|
+
assert.equal(activity.objectDisplayName, 'encrypted content');
|
|
285
|
+
assert.equal(activity.spaceName, contentContainer.containerName);
|
|
286
|
+
});
|
|
278
287
|
|
|
279
288
|
return result;
|
|
280
289
|
});
|
|
281
290
|
|
|
282
291
|
it('Decrypt function throws an exception', () => {
|
|
283
|
-
ctx.webex.internal.encryption.decryptText = sinon
|
|
292
|
+
ctx.webex.internal.encryption.decryptText = sinon
|
|
293
|
+
.stub()
|
|
294
|
+
.returns(Promise.reject(new Error('@@@@@@')));
|
|
284
295
|
|
|
285
296
|
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
286
297
|
.then(() => {
|
|
@@ -298,14 +309,13 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
298
309
|
// there should be no other content for a share
|
|
299
310
|
object.body.objectDisplayName = undefined;
|
|
300
311
|
object.body.files = [{displayName: 'file name', scr: 'eyJhbGciOi...'}];
|
|
301
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
302
|
-
.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
});
|
|
312
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
313
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 1);
|
|
314
|
+
assert.callCount(ctx.webex.internal.encryption.decryptScr, 1);
|
|
315
|
+
assert.equal(activity.objectDisplayName, undefined);
|
|
316
|
+
assert.equal(activity.files[0].displayName, decryptedText);
|
|
317
|
+
assert.equal(activity.files[0].scr, decryptedScr);
|
|
318
|
+
});
|
|
309
319
|
|
|
310
320
|
return result;
|
|
311
321
|
});
|
|
@@ -314,27 +324,31 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
314
324
|
object.body.verb = 'share';
|
|
315
325
|
// there should be no other content for a share
|
|
316
326
|
object.body.objectDisplayName = undefined;
|
|
317
|
-
object.body.files = [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
object.body.files = [
|
|
328
|
+
{
|
|
329
|
+
displayName: 'file name',
|
|
330
|
+
scr: 'eyJhbGciOi...',
|
|
331
|
+
microsoftSharedLinkInfo: {driveId: '1', itemId: '2'},
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
335
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 3);
|
|
336
|
+
assert.callCount(ctx.webex.internal.encryption.decryptScr, 1);
|
|
337
|
+
assert.equal(activity.objectDisplayName, undefined);
|
|
338
|
+
assert.equal(activity.files[0].displayName, decryptedText);
|
|
339
|
+
assert.equal(activity.files[0].scr, decryptedScr);
|
|
340
|
+
assert.equal(activity.files[0].microsoftSharedLinkInfo.driveId, decryptedText);
|
|
341
|
+
assert.equal(activity.files[0].microsoftSharedLinkInfo.itemId, decryptedText);
|
|
342
|
+
});
|
|
328
343
|
|
|
329
344
|
return result;
|
|
330
345
|
});
|
|
331
346
|
|
|
332
347
|
it('Adds warning to activity if warning found while retrieving space', () => {
|
|
333
348
|
contentContainer.warning = 'warn';
|
|
334
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
335
|
-
.
|
|
336
|
-
|
|
337
|
-
});
|
|
349
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
350
|
+
assert.equal(activity.warn, contentContainer.warn);
|
|
351
|
+
});
|
|
338
352
|
|
|
339
353
|
return result;
|
|
340
354
|
});
|
|
@@ -343,11 +357,10 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
343
357
|
object.body.verb = 'add';
|
|
344
358
|
object.body.objectDisplayName = undefined;
|
|
345
359
|
object.body.meeting = {title: 'Encrypted Title'};
|
|
346
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
347
|
-
.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
360
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
361
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 1);
|
|
362
|
+
assert.equal(activity.error, undefined);
|
|
363
|
+
});
|
|
351
364
|
|
|
352
365
|
return result;
|
|
353
366
|
});
|
|
@@ -356,11 +369,10 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
356
369
|
object.body.verb = 'add';
|
|
357
370
|
object.body.objectDisplayName = undefined;
|
|
358
371
|
object.body.recording = {topic: 'Encrypted Topic'};
|
|
359
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
360
|
-
.
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
});
|
|
372
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
373
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 1);
|
|
374
|
+
assert.equal(activity.error, undefined);
|
|
375
|
+
});
|
|
364
376
|
|
|
365
377
|
return result;
|
|
366
378
|
});
|
|
@@ -369,24 +381,26 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
369
381
|
object.body.verb = 'update';
|
|
370
382
|
object.body.spaceInfo = {name: 'Encrypted Name'};
|
|
371
383
|
object.body.objectDisplayName = undefined;
|
|
372
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
373
|
-
.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
});
|
|
384
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
385
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 1);
|
|
386
|
+
assert.equal(activity.error, undefined);
|
|
387
|
+
});
|
|
377
388
|
|
|
378
389
|
return result;
|
|
379
390
|
});
|
|
380
391
|
|
|
381
392
|
it('Calls the correct decrypt functions when transforming activity.spaceInfo.name with previousValue', () => {
|
|
382
393
|
object.body.verb = 'update';
|
|
383
|
-
object.body.spaceInfo = {
|
|
394
|
+
object.body.spaceInfo = {
|
|
395
|
+
name: 'Encrypted Name',
|
|
396
|
+
previousName: 'Previous Name',
|
|
397
|
+
previousEncryptionKeyUrl: keyUri,
|
|
398
|
+
};
|
|
384
399
|
object.body.objectDisplayName = undefined;
|
|
385
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
386
|
-
.
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
});
|
|
400
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
401
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 2);
|
|
402
|
+
assert.equal(activity.error, undefined);
|
|
403
|
+
});
|
|
390
404
|
|
|
391
405
|
return result;
|
|
392
406
|
});
|
|
@@ -395,11 +409,10 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
395
409
|
object.body.verb = 'update';
|
|
396
410
|
object.body.spaceInfo = {description: 'Encrypted Description'};
|
|
397
411
|
object.body.objectDisplayName = undefined;
|
|
398
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
399
|
-
.
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
});
|
|
412
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
413
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 1);
|
|
414
|
+
assert.equal(activity.error, undefined);
|
|
415
|
+
});
|
|
403
416
|
|
|
404
417
|
return result;
|
|
405
418
|
});
|
|
@@ -408,11 +421,10 @@ describe('EDiscovery Transform Tests', () => {
|
|
|
408
421
|
object.body.verb = 'update';
|
|
409
422
|
object.body.spaceInfo = {name: 'Encrypted Name', description: 'Encrypted description'};
|
|
410
423
|
object.body.objectDisplayName = undefined;
|
|
411
|
-
const result = Transforms.decryptReportContent(ctx, object, reportId)
|
|
412
|
-
.
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
});
|
|
424
|
+
const result = Transforms.decryptReportContent(ctx, object, reportId).then(() => {
|
|
425
|
+
assert.callCount(ctx.webex.internal.encryption.decryptText, 2);
|
|
426
|
+
assert.equal(activity.error, undefined);
|
|
427
|
+
});
|
|
416
428
|
|
|
417
429
|
return result;
|
|
418
430
|
});
|