def test_did_resolver_library(publisher_account, metadata_instance, ddo_sample_2): did_registry = keeper().did_registry checksum_test = Web3.keccak(text='checksum') value_test = metadata_instance.root_url did_resolver = DIDResolver(keeper().did_registry) did_seed = generate_prefixed_id() asset_id = did_registry.hash_did(did_seed, publisher_account.address) asset1 = ddo_sample_2 asset1._did = DID.did(asset_id) did_registry.register(did_seed, checksum_test, url=value_test, account=publisher_account) metadata_instance.publish_asset_ddo(asset1) did_resolved = did_resolver.resolve(asset1.did) assert did_resolved assert did_resolved.did == asset1.did with pytest.raises(ValueError): did_resolver.resolve(asset1.asset_id) metadata_instance.retire_asset_ddo(asset1.did)
def test_did_not_found(): did_resolver = DIDResolver(keeper().did_registry) did_id = secrets.token_hex(32) did_id_bytes = Web3.toBytes(hexstr=did_id) with pytest.raises(DIDNotFound): did_resolver.resolve(did_id_bytes)