mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Add integration test about adding permissions on DIDRegistry.
This commit is contained in:
parent
e4afe9d737
commit
476a624e89
@ -37,6 +37,16 @@ describe('Asset Owners', () => {
|
|||||||
assert.isTrue(isProvider)
|
assert.isTrue(isProvider)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should be added correctly a permission on an asset', async () => {
|
||||||
|
const ddo = await ocean.assets.create(metadata as any, account1)
|
||||||
|
|
||||||
|
assert.isFalse(await ocean.keeper.didRegistry.getPermission(ddo.id, account2.getId()))
|
||||||
|
|
||||||
|
await ocean.keeper.didRegistry.grantPermission(ddo.id, account2.getId(), account1.getId())
|
||||||
|
|
||||||
|
assert.isTrue(await ocean.keeper.didRegistry.getPermission(ddo.id, account2.getId()))
|
||||||
|
})
|
||||||
|
|
||||||
it('should get the assets owned by a user', async () => {
|
it('should get the assets owned by a user', async () => {
|
||||||
const { length: initialLength } = await ocean.assets.ownerAssets(account2.getId())
|
const { length: initialLength } = await ocean.assets.ownerAssets(account2.getId())
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export default class DIDRegistry extends ContractBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async grantPermission(did: string, grantee: string, ownerAddress: string) {
|
public async grantPermission(did: string, grantee: string, ownerAddress: string) {
|
||||||
return this.send('grantPermission', ownerAddress, [zeroX(did), zeroX(grantee)])
|
return this.send('grantPermission', ownerAddress, [didZeroX(did), zeroX(grantee)])
|
||||||
}
|
}
|
||||||
|
|
||||||
public async revokePermission(did: string, grantee: string, ownerAddress: string) {
|
public async revokePermission(did: string, grantee: string, ownerAddress: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user