difftreelog
CORE-410 Add specific ReFungible test for toke permissions.
in: master
1 file changed
tests/src/nesting/properties.test.tsdiffbeforeafterboth1123 await testForbidsAddingTooManyProperties({type: 'ReFungible'}, 100);1123 await testForbidsAddingTooManyProperties({type: 'ReFungible'}, 100);1124 });1124 });1125});1125});1126<<<<<<< HEAD1127=======11281129describe('ReFungible token properties permissions tests', () => {1130 let collection: number;1131 let token: number;11321133 before(async () => {1134 await usingApi(async (api, privateKeyWrapper) => {1135 alice = privateKeyWrapper('//Alice');1136 bob = privateKeyWrapper('//Bob');1137 charlie = privateKeyWrapper('//Charlie');1138 });1139 });11401141 beforeEach(async () => {1142 await usingApi(async api => {1143 collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});1144 token = await createItemExpectSuccess(alice, collection, 'ReFungible');1145 await addCollectionAdminExpectSuccess(alice, collection, bob.address);11461147 await expect(executeTransaction(1148 api, 1149 alice, 1150 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'key', permission: {mutable:true, tokenOwner: true}}]), 1151 )).to.not.be.rejected;1152 });1153 });11541155 it('Forbids add token property with tokenOwher==true but signer have\'t all pieces', async () => {1156 await usingApi(async api => {1157 await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');1158 1159 await expect(executeTransaction(1160 api, 1161 alice, 1162 api.tx.unique.setTokenProperties(collection, token, [1163 {key: 'key', value: 'word'}, 1164 ]), 1165 )).to.be.rejectedWith(/common\.NoPermission/);1166 });1167 });11681169 it('Forbids mutate token property with tokenOwher==true but signer have\'t all pieces', async () => {1170 await usingApi(async api => {1171 await expect(executeTransaction(1172 api, 1173 alice, 1174 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'key', permission: {mutable:true, tokenOwner: true}}]), 1175 )).to.not.be.rejected;1176 1177 await expect(executeTransaction(1178 api, 1179 alice, 1180 api.tx.unique.setTokenProperties(collection, token, [1181 {key: 'key', value: 'word'}, 1182 ]), 1183 )).to.be.not.rejected;11841185 await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');1186 1187 await expect(executeTransaction(1188 api, 1189 alice, 1190 api.tx.unique.setTokenProperties(collection, token, [1191 {key: 'key', value: 'bad word'}, 1192 ]), 1193 )).to.be.rejectedWith(/common\.NoPermission/);1194 });1195 });11961197 it('Forbids delete token property with tokenOwher==true but signer have\'t all pieces', async () => {1198 await usingApi(async api => {1199 await expect(executeTransaction(1200 api, 1201 alice, 1202 api.tx.unique.setTokenProperties(collection, token, [1203 {key: 'key', value: 'word'}, 1204 ]), 1205 )).to.be.not.rejected;12061207 await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');1208 1209 await expect(executeTransaction(1210 api, 1211 alice, 1212 api.tx.unique.deleteTokenProperties(collection, token, [1213 'key',1214 ]), 1215 )).to.be.rejectedWith(/common\.NoPermission/);1216 });1217 });1218});1219>>>>>>> 39e5dede (CORE-410 Add specific ReFungible test for toke permissions.)11261220