Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/catalog/test-subset.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"realm-policy-activation-test",
"realm-policy-anonymous-read-test",
"realm-policy-anonymous-search-test",
"realm-policy-anonymous-write-test",
"realm-policy-archived-seal-test",
"realm-policy-batch-test",
"realm-policy-capabilities-test",
Expand Down
25 changes: 16 additions & 9 deletions packages/realm-server/tests/realm-policy-anonymous-read-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ module(basename(import.meta.filename), function (hooks) {
anonymous: true,
where: '.status == "published"',
},
// Opts a write in to such callers, which no route admits them
// to, so it never admits one.
// Opts a write in to such callers as an acting user the
// newsroom's config doesn't name, so it never admits one.
{
operation: 'update',
anonymous: true,
Expand Down Expand Up @@ -554,9 +554,9 @@ module(basename(import.meta.filename), function (hooks) {
);
let update = await explainAnonymous(NEWSROOM_POLICY, PUBLISHED, 'update');
assert.strictEqual(
update.reason,
'actor-required',
'a write is answered as its route answers it, whatever the policy opens',
update.decision,
'denied',
'a write whose acting user the realm does not name admits nothing',
);
});

Expand Down Expand Up @@ -825,18 +825,21 @@ module(basename(import.meta.filename), function (hooks) {
.send(JSON.stringify({ filter: { type: ARTICLE } })),
],
[
'an operations batch',
'an operations batch that creates',
() =>
request
.post(`${path}_operations`)
.set('X-HTTP-Method-Override', 'QUERY')
.set('Accept', SupportedMimeType.BoxelOperations)
.set('Content-Type', SupportedMimeType.BoxelOperations)
.set('X-Forwarded-For', VISITOR)
.send(
JSON.stringify({
'boxel:operations': [
{ op: 'invoke', 'boxel:name': 'read', href: PUBLISHED },
{
op: 'invoke',
'boxel:name': 'create',
data: JSON.parse(document).data,
},
],
}),
),
Expand Down Expand Up @@ -871,6 +874,10 @@ module(basename(import.meta.filename), function (hooks) {
for (let [label, send] of closed) {
assert.strictEqual((await send()).status, 401, `${label}: 401`);
}
assert.deepEqual(articleRecords(), [], 'and none of them is admitted');
assert.deepEqual(
articleRecords().filter((r) => r.outcome !== 'refused'),
[],
'and none of them is admitted',
);
});
});
Loading
Loading