forked from storacha/w3up
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): add test to authorize gateway
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,6 +320,43 @@ export const testSpace = { | |
assert.match(error, /wait.*plan.*select/i) | ||
}), | ||
|
||
'storacha space create home --no-recovery --customer [email protected] --account [email protected] --authorize-gateway-services': | ||
test(async (assert, context) => { | ||
const email = '[email protected]' | ||
await login(context, { email }) | ||
await selectPlan(context, { email }) | ||
|
||
const serverId = context.connection.id | ||
const serverURL = context.serverURL | ||
|
||
const { output } = await storacha | ||
.args([ | ||
'space', | ||
'create', | ||
'home', | ||
'--no-recovery', | ||
'--customer', | ||
email, | ||
'--account', | ||
email, | ||
'--authorize-gateway-services', | ||
`[{"id":"${serverId}","serviceEndpoint":"${serverURL}"}]`, | ||
]) | ||
.env(context.env.alice) | ||
.join() | ||
|
||
assert.match(output, /account is authorized/i) | ||
|
||
const result = await context.delegationsStorage.find({ | ||
audience: DIDMailto.fromEmail(email), | ||
}) | ||
|
||
assert.ok( | ||
result.ok?.find((d) => d.capabilities[0].can === '*'), | ||
'account has been delegated access to the space' | ||
) | ||
}), | ||
|
||
'storacha space add': test(async (assert, context) => { | ||
const { env } = context | ||
|
||
|