1
0
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:
Pedro Gutiérrez 2019-09-26 14:59:05 +02:00 committed by Matthias Kretschmann
parent e4afe9d737
commit 476a624e89
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,16 @@ describe('Asset Owners', () => {
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 () => {
const { length: initialLength } = await ocean.assets.ownerAssets(account2.getId())

View File

@ -50,7 +50,7 @@ export default class DIDRegistry extends ContractBase {
}
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) {