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')
|
||||
|
||||
@@ -18,6 +18,7 @@ before(async () => {
|
||||
],
|
||||
workorders: [{ $id: 't1', woid: '100115', customerId: 'c1', status: 'Open' }],
|
||||
customers: [{ $id: 'c1', name: 'Döner Nation' }],
|
||||
portalFeatures: [{ $id: 'f1', customerId: 'c1', projectId: 'p1', featureKey: 'analyse', state: 'active' }],
|
||||
},
|
||||
})
|
||||
Object.assign(process.env, { APPWRITE_ENDPOINT: aw.endpoint, APPWRITE_API_KEY: 'test-key' })
|
||||
@@ -53,10 +54,29 @@ test('Katalog + Gruppen, Archiv/Vorlage ausgeschlossen, Namen aufgelöst', async
|
||||
assert.deepEqual(body.groups.website[0], {
|
||||
id: 'p1', projectName: 'Doener', repoFullName: 'JUSN/doener', customerId: 'c1',
|
||||
customerName: 'Döner Nation', ticketId: 't1', woid: '100115',
|
||||
previewUrl: 'https://doener.project.webklar.com', previewState: '', features: {},
|
||||
previewUrl: 'https://doener.project.webklar.com', previewState: '', features: { analyse: 'active' },
|
||||
})
|
||||
assert.equal(body.groups.missing[0].previewUrl, 'https://ohne.de')
|
||||
assert.equal(body.groups.missing[0].customerName, '')
|
||||
const all = Object.values(body.groups).flat().map((p) => p.id)
|
||||
assert.ok(!all.includes('p3') && !all.includes('p4'))
|
||||
})
|
||||
|
||||
test('Analyse: features.analyse je Projekt, Katalogstatus folgt ANALYSE_ENABLED', async () => {
|
||||
const { config } = await import('../server/config.js')
|
||||
const was = config.analyse.enabled
|
||||
try {
|
||||
config.analyse.enabled = false
|
||||
let body = await (await get('jwt-admin')).json()
|
||||
assert.equal(body.features.analyse.status, 'in_development')
|
||||
config.analyse.enabled = true
|
||||
body = await (await get('jwt-admin')).json()
|
||||
assert.equal(body.features.analyse.status, 'available')
|
||||
assert.equal(body.groups.website[0].features.analyse, 'active')
|
||||
assert.equal(body.groups.missing[0].features.analyse, null)
|
||||
} finally {
|
||||
config.analyse.enabled = was
|
||||
}
|
||||
const { FEATURES } = await import('../server/services/projectKinds.js')
|
||||
assert.equal(FEATURES.analyse.status, 'in_development')
|
||||
})
|
||||
Reference in new issue
Block a user