Пример #1
0
def test_get_resolve_url(metadata_instance, publisher_account):
    register_account = publisher_account
    did_registry = keeper().did_registry

    did_seed = generate_prefixed_id()
    asset_id = did_registry.hash_did(did_seed, register_account.address)

    did = DID.did(asset_id)

    value_test = metadata_instance.root_url
    did_resolver = DIDResolver(keeper().did_registry)
    did_registry.register(did_seed,
                          b'test',
                          url=value_test,
                          account=register_account)
    url = did_resolver.get_resolve_url(Web3.toBytes(hexstr=asset_id))
    assert url == value_test
Пример #2
0
def test_get_resolve_multiple_urls(publisher_account):
    register_account = publisher_account
    did_registry = keeper().did_registry
    did_resolver = DIDResolver(keeper().did_registry)

    iterations = 3
    counter = 0

    while counter < iterations:
        _seed = generate_prefixed_id()
        _asset_id = did_registry.hash_did(_seed, register_account.address)
        _url = 'http://localhost:5000/' + str(counter)
        did_registry.register(_seed,
                              b'test',
                              url=_url,
                              account=register_account)
        assert did_resolver.get_resolve_url(
            Web3.toBytes(hexstr=_asset_id)) == _url
        counter = counter + 1
Пример #3
0
def test_get_did_not_valid():
    did_resolver = DIDResolver(keeper().did_registry)
    with pytest.raises(TypeError):
        did_resolver.get_resolve_url('not valid')