Skip to content

Commit e43b2a6

Browse files
committed
chore: output user
1 parent ddbb8a5 commit e43b2a6

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

test/it/it-tests.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
1616
// Enable bail to stop on first failure - tests are interdependent
1717
this.bail(true);
1818

19-
it('should set org config', async function shouldSetOrgConfig() {
19+
it('[super user] should set org config', async function shouldSetOrgConfig() {
2020
if (!ctx.local) {
2121
// in stage, the config is already set and we should not overwrite it
2222
// to preserve the setup and be able to access the content
@@ -47,7 +47,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
4747
headers: { Authorization: `Bearer ${superUser.accessToken}` },
4848
});
4949

50-
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status}`);
50+
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status} - user: ${superUser.email}`);
5151
});
5252

5353
it('[super user] should get org config', async () => {
@@ -59,7 +59,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
5959
headers: { Authorization: `Bearer ${superUser.accessToken}` },
6060
});
6161

62-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
62+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${superUser.email}`);
6363

6464
const body = await resp.json();
6565
assert.strictEqual(body.total, 2, `Expected 2, got ${body.total}`);
@@ -91,10 +91,10 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
9191
method: 'DELETE',
9292
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
9393
});
94-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
94+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
9595
});
9696

97-
it('[super user] delete root folder to cleanup the bucket', async () => {
97+
it('[super user] should delete root folder to cleanup the bucket', async () => {
9898
const {
9999
serverUrl, org, repo, superUser,
100100
} = ctx;
@@ -103,15 +103,15 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
103103
method: 'DELETE',
104104
headers: { Authorization: `Bearer ${superUser.accessToken}` },
105105
});
106-
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status}`);
106+
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status} - user: ${superUser.email}`);
107107

108108
// validate bucket is empty
109109
const listResp = await fetch(`${serverUrl}/list/${org}/${repo}`, {
110110
headers: { Authorization: `Bearer ${superUser.accessToken}` },
111111
});
112-
assert.strictEqual(listResp.status, 200, `Expected 200 OK, got ${listResp.status}`);
112+
assert.strictEqual(listResp.status, 200, `Expected 200 OK, got ${listResp.status} - user: ${superUser.email}`);
113113
const listBody = await listResp.json();
114-
assert.strictEqual(listBody.length, 0, `Expected 0 items, got ${listBody.length}`);
114+
assert.strictEqual(listBody.length, 0, `Expected 0 items, got ${listBody.length} - user: ${superUser.email}`);
115115
});
116116

117117
it('[super user] should create a repo', async () => {
@@ -123,7 +123,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
123123
method: 'PUT',
124124
headers: { Authorization: `Bearer ${superUser.accessToken}` },
125125
});
126-
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201 for marker, got ${resp.status}`);
126+
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201 for marker, got ${resp.status} - user: ${superUser.email}`);
127127
});
128128

129129
it('[anonymous] not allowed to read', async () => {
@@ -146,7 +146,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
146146
method: 'GET',
147147
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
148148
});
149-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
149+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
150150
});
151151

152152
it('[anonymous] cannot list repos', async () => {
@@ -166,7 +166,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
166166
const resp = await fetch(url, {
167167
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
168168
});
169-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
169+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
170170
});
171171

172172
it('[super user] should list repos', async () => {
@@ -178,13 +178,13 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
178178
headers: { Authorization: `Bearer ${superUser.accessToken}` },
179179
});
180180

181-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
181+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${superUser.email}`);
182182

183183
const body = await resp.json();
184-
assert.ok(body.length > 0, `Expected at least 1 repo, got ${body.length}`);
184+
assert.ok(body.length > 0, `Expected at least 1 repo, got ${body.length} - user: ${superUser.email}`);
185185
// need to find the current repo in the list
186186
const repoItem = body.find((item) => item.name === repo);
187-
assert.ok(repoItem, `Expected ${repo} to be in the list`);
187+
assert.ok(repoItem, `Expected ${repo} to be in the list - user: ${superUser.email}`);
188188
});
189189

190190
it('[anonymous] cannot create a page', async () => {
@@ -231,7 +231,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
231231
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
232232
});
233233

234-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
234+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
235235
});
236236

237237
it('[super user] should create pages', async () => {
@@ -255,7 +255,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
255255
headers: { Authorization: `Bearer ${superUser.accessToken}` },
256256
});
257257

258-
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status}`);
258+
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status} - user: ${superUser.email}`);
259259

260260
let body = await resp.json();
261261
assert.strictEqual(body.source.editUrl, `https://da.live/edit#/${org}/${repo}/${key}`);
@@ -268,7 +268,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
268268
headers: { Authorization: `Bearer ${superUser.accessToken}` },
269269
});
270270

271-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
271+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${superUser.email}`);
272272

273273
body = await resp.text();
274274
assert.strictEqual(body, '<html><body><h1>Page 1</h1></body></html>');
@@ -285,7 +285,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
285285
body: formData2,
286286
headers: { Authorization: `Bearer ${superUser.accessToken}` },
287287
});
288-
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status}`);
288+
assert.ok([200, 201].includes(resp.status), `Expected 200 or 201, got ${resp.status} - user: ${superUser.email}`);
289289
});
290290

291291
it('[limited user] cannot read page1', async () => {
@@ -296,7 +296,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
296296
const resp = await fetch(url, {
297297
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
298298
});
299-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
299+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
300300
});
301301

302302
it('[limited user] cannot read page2', async () => {
@@ -307,7 +307,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
307307
const resp = await fetch(url, {
308308
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
309309
});
310-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
310+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
311311
});
312312

313313
it('[super user] should update the config to allow limited user to read page2', async () => {
@@ -340,7 +340,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
340340
body: formData,
341341
headers: { Authorization: `Bearer ${superUser.accessToken}` },
342342
});
343-
assert.strictEqual(resp.status, 201, `Expected 201 Created, got ${resp.status}`);
343+
assert.strictEqual(resp.status, 201, `Expected 201 Created, got ${resp.status} - user: ${superUser.email}`);
344344
});
345345

346346
it('[limited user] can now read page2', async () => {
@@ -376,7 +376,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
376376
body: formData,
377377
headers: { Authorization: `Bearer ${superUser.accessToken}` },
378378
});
379-
assert.strictEqual(resp.status, 201, `Expected 201 Created, got ${resp.status}`);
379+
assert.strictEqual(resp.status, 201, `Expected 201 Created, got ${resp.status} - user: ${superUser.email}`);
380380
resp = await fetch(url, {
381381
headers: { Authorization: `Bearer ${superUser.accessToken}` },
382382
});
@@ -399,7 +399,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
399399
const resp = await fetch(url, {
400400
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
401401
});
402-
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status}`);
402+
assert.strictEqual(resp.status, 403, `Expected 403 Unauthorized, got ${resp.status} - user: ${limitedUser.email}`);
403403
});
404404

405405
it('[anonymous] cannot list objects', async () => {
@@ -422,7 +422,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
422422
headers: { Authorization: `Bearer ${superUser.accessToken}` },
423423
});
424424

425-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
425+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${superUser.email}`);
426426

427427
const body = await resp.json();
428428

@@ -454,13 +454,13 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
454454
method: 'DELETE',
455455
headers: { Authorization: `Bearer ${superUser.accessToken}` },
456456
});
457-
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status}`);
457+
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status} - user: ${superUser.email}`);
458458

459459
// validate page is not here
460460
resp = await fetch(`${serverUrl}/source/${org}/${repo}/${key}${ext}`, {
461461
headers: { Authorization: `Bearer ${superUser.accessToken}` },
462462
});
463-
assert.strictEqual(resp.status, 404, `Expected 404 Not Found, got ${resp.status}`);
463+
assert.strictEqual(resp.status, 404, `Expected 404 Not Found, got ${resp.status} - user: ${superUser.email}`);
464464
});
465465

466466
it('[super user] should do a final delete of the root folder', async () => {
@@ -472,7 +472,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
472472
method: 'DELETE',
473473
headers: { Authorization: `Bearer ${superUser.accessToken}` },
474474
});
475-
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status}`);
475+
assert.strictEqual(resp.status, 204, `Expected 204 No Content, got ${resp.status} - user: ${superUser.email}`);
476476
});
477477

478478
it('[limited user] should logout', async () => {
@@ -483,7 +483,7 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
483483
headers: { Authorization: `Bearer ${limitedUser.accessToken}` },
484484
});
485485

486-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
486+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${limitedUser.email}`);
487487
});
488488

489489
it('[super user] should logout', async () => {
@@ -494,6 +494,6 @@ export default (ctx) => describe('Integration Tests: it tests', function () {
494494
headers: { Authorization: `Bearer ${superUser.accessToken}` },
495495
});
496496

497-
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status}`);
497+
assert.strictEqual(resp.status, 200, `Expected 200 OK, got ${resp.status} - user: ${superUser.userId}`);
498498
});
499499
});

0 commit comments

Comments
 (0)