@webex/internal-plugin-ediscovery 2.59.2 → 2.59.3-next.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.
@@ -1,208 +1,208 @@
1
- import '@webex/internal-plugin-ediscovery';
2
- import ReportRequest from '@webex/internal-plugin-ediscovery/src/report-request';
3
- import {assert} from '@webex/test-helper-chai';
4
- import WebexCore from '@webex/webex-core';
5
- import testUsers from '@webex/test-helper-test-users';
6
- import uuid from 'uuid';
7
-
8
- describe('internal-plugin-ediscovery', () => {
9
- let complianceUser;
10
- const reportId = uuid.v4();
11
- const containerId = uuid.v4();
12
-
13
- before('create compliance officer test user', () =>
14
- testUsers
15
- .create({
16
- count: 1,
17
- config: {
18
- entitlements: [
19
- 'sparkCompliance',
20
- 'sparkAdmin',
21
- 'spark',
22
- 'squaredCallInitiation',
23
- 'squaredRoomModeration',
24
- 'squaredInviter',
25
- 'webExSquared',
26
- ],
27
- scope: 'spark-compliance:ediscovery_report',
28
- roles: [{name: 'spark.kms_orgagent'}],
29
- },
30
- })
31
- .then((users) => {
32
- complianceUser = users[0];
33
- complianceUser.webex = new WebexCore({
34
- credentials: {
35
- authorization: complianceUser.token,
36
- },
37
- });
38
- assert.isTrue(complianceUser.webex.canAuthorize);
39
- })
40
- .catch((error) => {
41
- assert.isTrue(error);
42
- })
43
- .then(() => complianceUser.webex.internal.device.register())
44
- );
45
-
46
- describe('Requests connect to ediscovery and return 4xx response', () => {
47
- it('createReport fails with 400 due to invalid report request', async () => {
48
- await complianceUser.webex.internal.ediscovery
49
- .createReport(new ReportRequest())
50
- .then(() => {
51
- assert.fail('Expected error response due to invalid report request');
52
- })
53
- .catch((error) => {
54
- assert.equal(error.statusCode, 400);
55
- assert.include(error.message, 'Report Request must have at least one Email');
56
- });
57
- });
58
-
59
- it('getReports fails with 404 due to no reports for this user', async () => {
60
- await complianceUser.webex.internal.ediscovery
61
- .getReports()
62
- .then(() => {
63
- assert.fail('Expected error response due to no reports for user');
64
- })
65
- .catch((error) => {
66
- assert.equal(error.statusCode, 404);
67
- assert.include(
68
- error.message,
69
- `No records were found for this compliance officer: ${complianceUser.id}`
70
- );
71
- });
72
- });
73
-
74
- it('getReport fails with 404 due to invalid report id', async () => {
75
- await complianceUser.webex.internal.ediscovery
76
- .getReport(reportId)
77
- .then(() => {
78
- assert.fail('Expected error response due to invalid report id');
79
- })
80
- .catch((error) => {
81
- assert.equal(error.statusCode, 404);
82
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
83
- });
84
- });
85
-
86
- it('deleteReport fails with 404 due to invalid report id', async () => {
87
- await complianceUser.webex.internal.ediscovery
88
- .deleteReport(reportId)
89
- .then(() => {
90
- assert.fail('Expected error response due to invalid report id');
91
- })
92
- .catch((error) => {
93
- assert.equal(error.statusCode, 404);
94
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
95
- });
96
- });
97
-
98
- it('restartReport fails with 404 due to invalid report id', async () => {
99
- await complianceUser.webex.internal.ediscovery
100
- .restartReport(reportId)
101
- .then(() => {
102
- assert.fail('Expected error response due to invalid report id');
103
- })
104
- .catch((error) => {
105
- assert.equal(error.statusCode, 404);
106
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
107
- });
108
- });
109
-
110
- it('getContent fails with 404 due to invalid report id', async () => {
111
- await complianceUser.webex.internal.ediscovery
112
- .getContent(reportId)
113
- .then(() => {
114
- assert.fail('Expected error response due to invalid report id');
115
- })
116
- .catch((error) => {
117
- assert.equal(error.statusCode, 404);
118
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
119
- });
120
- });
121
-
122
- it('getClientConfig succeeds', async () => {
123
- await complianceUser.webex.internal.ediscovery
124
- .getClientConfig()
125
- .then((res) => {
126
- assert.equal(res.statusCode, 200);
127
- assert.isNotEmpty(res);
128
- })
129
- .catch(() => {
130
- assert.fail('Expected valid response');
131
- });
132
- });
133
-
134
- describe('Requests with url parameter connect to remote ediscovery and return 4xx response', () => {
135
- const validUrl = `https://ediscovery-intb.wbx2.com/ediscovery/api/v1/reports/${reportId}`;
136
- const invalidUrl = `https://ediscovery-intz.wbx2.com/ediscovery/api/v1/reports/${reportId}`;
137
-
138
- it('getContent by url succeeds with valid url', async () => {
139
- await complianceUser.webex.internal.ediscovery
140
- .getContent(validUrl)
141
- .then(() => {
142
- assert.fail('Expected error response due to invalid report id');
143
- })
144
- .catch((error) => {
145
- assert.equal(error.statusCode, 404);
146
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
147
- });
148
- });
149
-
150
- it('getContent by url fails with invalid url', async () => {
151
- await complianceUser.webex.internal.ediscovery
152
- .getContent(invalidUrl)
153
- .then(() => {
154
- assert.fail('Expected error response due to invalid url');
155
- })
156
- .catch((error) => {
157
- assert.equal(error.statusCode, 0);
158
- });
159
- });
160
-
161
- it('getContentContainer by url succeeds with valid url', async () => {
162
- await complianceUser.webex.internal.ediscovery
163
- .getContentContainer(validUrl)
164
- .then(() => {
165
- assert.fail('Expected error response due to invalid report id');
166
- })
167
- .catch((error) => {
168
- assert.equal(error.statusCode, 404);
169
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
170
- });
171
- });
172
-
173
- it('getContentContainer by url fails with invalid url', async () => {
174
- await complianceUser.webex.internal.ediscovery
175
- .getContentContainer(invalidUrl)
176
- .then(() => {
177
- assert.fail('Expected error response due to invalid url');
178
- })
179
- .catch((error) => {
180
- assert.equal(error.statusCode, 0);
181
- });
182
- });
183
-
184
- it('getContentContainerByContainerId by url succeeds with valid url', async () => {
185
- await complianceUser.webex.internal.ediscovery
186
- .getContentContainerByContainerId(validUrl, containerId)
187
- .then(() => {
188
- assert.fail('Expected error response due to invalid report id');
189
- })
190
- .catch((error) => {
191
- assert.equal(error.statusCode, 404);
192
- assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
193
- });
194
- });
195
-
196
- it('getContentContainerByContainerId by url fails with invalid url', async () => {
197
- await complianceUser.webex.internal.ediscovery
198
- .getContentContainerByContainerId(invalidUrl, containerId)
199
- .then(() => {
200
- assert.fail('Expected error response due to invalid url');
201
- })
202
- .catch((error) => {
203
- assert.equal(error.statusCode, 0);
204
- });
205
- });
206
- });
207
- });
208
- });
1
+ import '@webex/internal-plugin-ediscovery';
2
+ import ReportRequest from '@webex/internal-plugin-ediscovery/src/report-request';
3
+ import {assert} from '@webex/test-helper-chai';
4
+ import WebexCore from '@webex/webex-core';
5
+ import testUsers from '@webex/test-helper-test-users';
6
+ import uuid from 'uuid';
7
+
8
+ describe('internal-plugin-ediscovery', () => {
9
+ let complianceUser;
10
+ const reportId = uuid.v4();
11
+ const containerId = uuid.v4();
12
+
13
+ before('create compliance officer test user', () =>
14
+ testUsers
15
+ .create({
16
+ count: 1,
17
+ config: {
18
+ entitlements: [
19
+ 'sparkCompliance',
20
+ 'sparkAdmin',
21
+ 'spark',
22
+ 'squaredCallInitiation',
23
+ 'squaredRoomModeration',
24
+ 'squaredInviter',
25
+ 'webExSquared',
26
+ ],
27
+ scope: 'spark-compliance:ediscovery_report',
28
+ roles: [{name: 'spark.kms_orgagent'}],
29
+ },
30
+ })
31
+ .then((users) => {
32
+ complianceUser = users[0];
33
+ complianceUser.webex = new WebexCore({
34
+ credentials: {
35
+ authorization: complianceUser.token,
36
+ },
37
+ });
38
+ assert.isTrue(complianceUser.webex.canAuthorize);
39
+ })
40
+ .catch((error) => {
41
+ assert.isTrue(error);
42
+ })
43
+ .then(() => complianceUser.webex.internal.device.register())
44
+ );
45
+
46
+ describe('Requests connect to ediscovery and return 4xx response', () => {
47
+ it('createReport fails with 400 due to invalid report request', async () => {
48
+ await complianceUser.webex.internal.ediscovery
49
+ .createReport(new ReportRequest())
50
+ .then(() => {
51
+ assert.fail('Expected error response due to invalid report request');
52
+ })
53
+ .catch((error) => {
54
+ assert.equal(error.statusCode, 400);
55
+ assert.include(error.message, 'Report Request must have at least one Email');
56
+ });
57
+ });
58
+
59
+ it('getReports fails with 404 due to no reports for this user', async () => {
60
+ await complianceUser.webex.internal.ediscovery
61
+ .getReports()
62
+ .then(() => {
63
+ assert.fail('Expected error response due to no reports for user');
64
+ })
65
+ .catch((error) => {
66
+ assert.equal(error.statusCode, 404);
67
+ assert.include(
68
+ error.message,
69
+ `No records were found for this compliance officer: ${complianceUser.id}`
70
+ );
71
+ });
72
+ });
73
+
74
+ it('getReport fails with 404 due to invalid report id', async () => {
75
+ await complianceUser.webex.internal.ediscovery
76
+ .getReport(reportId)
77
+ .then(() => {
78
+ assert.fail('Expected error response due to invalid report id');
79
+ })
80
+ .catch((error) => {
81
+ assert.equal(error.statusCode, 404);
82
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
83
+ });
84
+ });
85
+
86
+ it('deleteReport fails with 404 due to invalid report id', async () => {
87
+ await complianceUser.webex.internal.ediscovery
88
+ .deleteReport(reportId)
89
+ .then(() => {
90
+ assert.fail('Expected error response due to invalid report id');
91
+ })
92
+ .catch((error) => {
93
+ assert.equal(error.statusCode, 404);
94
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
95
+ });
96
+ });
97
+
98
+ it('restartReport fails with 404 due to invalid report id', async () => {
99
+ await complianceUser.webex.internal.ediscovery
100
+ .restartReport(reportId)
101
+ .then(() => {
102
+ assert.fail('Expected error response due to invalid report id');
103
+ })
104
+ .catch((error) => {
105
+ assert.equal(error.statusCode, 404);
106
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
107
+ });
108
+ });
109
+
110
+ it('getContent fails with 404 due to invalid report id', async () => {
111
+ await complianceUser.webex.internal.ediscovery
112
+ .getContent(reportId)
113
+ .then(() => {
114
+ assert.fail('Expected error response due to invalid report id');
115
+ })
116
+ .catch((error) => {
117
+ assert.equal(error.statusCode, 404);
118
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
119
+ });
120
+ });
121
+
122
+ it('getClientConfig succeeds', async () => {
123
+ await complianceUser.webex.internal.ediscovery
124
+ .getClientConfig()
125
+ .then((res) => {
126
+ assert.equal(res.statusCode, 200);
127
+ assert.isNotEmpty(res);
128
+ })
129
+ .catch(() => {
130
+ assert.fail('Expected valid response');
131
+ });
132
+ });
133
+
134
+ describe('Requests with url parameter connect to remote ediscovery and return 4xx response', () => {
135
+ const validUrl = `https://ediscovery-intb.wbx2.com/ediscovery/api/v1/reports/${reportId}`;
136
+ const invalidUrl = `https://ediscovery-intz.wbx2.com/ediscovery/api/v1/reports/${reportId}`;
137
+
138
+ it('getContent by url succeeds with valid url', async () => {
139
+ await complianceUser.webex.internal.ediscovery
140
+ .getContent(validUrl)
141
+ .then(() => {
142
+ assert.fail('Expected error response due to invalid report id');
143
+ })
144
+ .catch((error) => {
145
+ assert.equal(error.statusCode, 404);
146
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
147
+ });
148
+ });
149
+
150
+ it('getContent by url fails with invalid url', async () => {
151
+ await complianceUser.webex.internal.ediscovery
152
+ .getContent(invalidUrl)
153
+ .then(() => {
154
+ assert.fail('Expected error response due to invalid url');
155
+ })
156
+ .catch((error) => {
157
+ assert.equal(error.statusCode, 0);
158
+ });
159
+ });
160
+
161
+ it('getContentContainer by url succeeds with valid url', async () => {
162
+ await complianceUser.webex.internal.ediscovery
163
+ .getContentContainer(validUrl)
164
+ .then(() => {
165
+ assert.fail('Expected error response due to invalid report id');
166
+ })
167
+ .catch((error) => {
168
+ assert.equal(error.statusCode, 404);
169
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
170
+ });
171
+ });
172
+
173
+ it('getContentContainer by url fails with invalid url', async () => {
174
+ await complianceUser.webex.internal.ediscovery
175
+ .getContentContainer(invalidUrl)
176
+ .then(() => {
177
+ assert.fail('Expected error response due to invalid url');
178
+ })
179
+ .catch((error) => {
180
+ assert.equal(error.statusCode, 0);
181
+ });
182
+ });
183
+
184
+ it('getContentContainerByContainerId by url succeeds with valid url', async () => {
185
+ await complianceUser.webex.internal.ediscovery
186
+ .getContentContainerByContainerId(validUrl, containerId)
187
+ .then(() => {
188
+ assert.fail('Expected error response due to invalid report id');
189
+ })
190
+ .catch((error) => {
191
+ assert.equal(error.statusCode, 404);
192
+ assert.include(error.message, `Report Record with ID[${reportId}] could not be found`);
193
+ });
194
+ });
195
+
196
+ it('getContentContainerByContainerId by url fails with invalid url', async () => {
197
+ await complianceUser.webex.internal.ediscovery
198
+ .getContentContainerByContainerId(invalidUrl, containerId)
199
+ .then(() => {
200
+ assert.fail('Expected error response due to invalid url');
201
+ })
202
+ .catch((error) => {
203
+ assert.equal(error.statusCode, 0);
204
+ });
205
+ });
206
+ });
207
+ });
208
+ });