Skip to content

Commit 44dc03e

Browse files
committed
test: Make sure OIDC tests check relevant policies
1 parent 75d7e8d commit 44dc03e

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

test/integration/Oidc.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlgJwk, App, CachedJwkGenerator, MemoryMapStorage } from '@solid/community-server';
1+
import { AlgJwk, App, CachedJwkGenerator, joinUrl, MemoryMapStorage } from '@solid/community-server';
22
import { setGlobalLoggerFactory, WinstonLoggerFactory } from 'global-logger-factory';
33
import { decodeJwt, importJWK, SignJWT } from 'jose';
44
import { randomUUID } from 'node:crypto';
@@ -165,6 +165,14 @@ describe('A server supporting OIDC tokens', (): void => {
165165
expect(payload.sub).toBe(sub);
166166
expect(payload.sub).not.toBe(`http://example.com/id/${sub}`);
167167
});
168+
169+
it('can remove the policy.', async(): Promise<void> => {
170+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policyStandard')), {
171+
method: 'DELETE',
172+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
173+
});
174+
expect(response.status).toBe(204);
175+
});
168176
});
169177

170178
describe('accessing a resource using a standard OIDC token with a specific client.', (): void => {
@@ -233,6 +241,14 @@ describe('A server supporting OIDC tokens', (): void => {
233241
});
234242
expect(response.status).toBe(200);
235243
});
244+
245+
it('can remove the policy.', async(): Promise<void> => {
246+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policyStandardClient')), {
247+
method: 'DELETE',
248+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
249+
});
250+
expect(response.status).toBe(204);
251+
});
236252
});
237253

238254
describe('accessing a resource using a Solid OIDC token.', (): void => {
@@ -286,6 +302,14 @@ describe('A server supporting OIDC tokens', (): void => {
286302
});
287303
expect(response.status).toBe(200);
288304
});
305+
306+
it('can remove the policy.', async(): Promise<void> => {
307+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policySolid')), {
308+
method: 'DELETE',
309+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
310+
});
311+
expect(response.status).toBe(204);
312+
});
289313
});
290314

291315
describe('accessing a resource using a Solid OIDC token with a specific client.', (): void => {
@@ -356,5 +380,13 @@ describe('A server supporting OIDC tokens', (): void => {
356380
});
357381
expect(response.status).toBe(200);
358382
});
383+
384+
it('can remove the policy.', async(): Promise<void> => {
385+
const response = await fetch(joinUrl(policyEndpoint, encodeURIComponent('http://example.org/policySolidClient')), {
386+
method: 'DELETE',
387+
headers: { authorization: `WebID ${encodeURIComponent(webId)}`, 'content-type': 'text/turtle' },
388+
});
389+
expect(response.status).toBe(204);
390+
});
359391
});
360392
});

0 commit comments

Comments
 (0)