Analyse: Lesezugriff fuer WOMS
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
821e947275
commit
0b59dac2be
4 files changed
+91
-4
No files matched your search
@@ -192,6 +192,30 @@ test('Admin: 401, 400, 200', async () => {
|
||||
assert.deepEqual(off.body, { ok: true, state: 'off' })
|
||||
})
|
||||
|
||||
test('Admin: Lesezugriff GET', async () => {
|
||||
const adminGet = (id, jwt = 'jwt-admin') => rawGet(`/api/admin/analyse/${id}`, { headers: { Authorization: `Bearer ${jwt}` } })
|
||||
assert.equal((await rawGet('/api/admin/analyse/p1')).status, 401)
|
||||
assert.equal((await adminGet('p1', 'jwt-kunde')).status, 403)
|
||||
assert.equal((await adminGet('nix')).status, 404)
|
||||
await adminPost('p1', { on: false })
|
||||
const off = await adminGet('p1')
|
||||
assert.equal(off.status, 200)
|
||||
assert.equal(off.body.enabled, true)
|
||||
assert.equal(off.body.eligible, true)
|
||||
assert.equal(off.body.reasonText, null)
|
||||
assert.equal(off.body.avvVersion, config.analyse.avvVersion)
|
||||
await adminPost('p1', { on: true, avvConfirmedVerbally: true })
|
||||
const on = await adminGet('p1')
|
||||
assert.equal(on.body.state, 'active')
|
||||
assert.equal(on.body.avvAcceptedBy, 'kenso@webklar.com')
|
||||
assert.ok(on.body.activatedAt)
|
||||
assert.ok(!('siteKey' in on.body) && !JSON.stringify(on.body).includes((await featureDoc('c1', 'p1')).siteKey))
|
||||
const priv = await adminGet('p2')
|
||||
assert.equal(priv.body.eligible, false)
|
||||
assert.equal(priv.body.state, null)
|
||||
assert.equal(priv.body.reasonText, 'Die Website-Analyse gibt es nur für öffentliche Websites.')
|
||||
})
|
||||
|
||||
test('Fix a: Kunde ändert gesperrtes Dokument nicht, Mitarbeiter schon', async () => {
|
||||
await adminPost('p6', { on: true, avvConfirmedVerbally: true })
|
||||
const cur = await featureDoc('c1', 'p6')
|
||||
|
||||
Reference in new issue
Block a user