Esempio n. 1
0
 def fetch_uri_contents(self, uri: URI, package_name: str,
                        package_version: str) -> URI:
     manifest = build_etherscan_manifest(uri, package_name, package_version)
     ipfs_backend = get_ipfs_backend()
     ipfs_data = builder.build(manifest, builder.validate(),
                               builder.pin_to_ipfs(backend=ipfs_backend))
     return URI(f"ipfs://{ipfs_data[0]['Hash']}")
Esempio n. 2
0
def test_builder_pins_manifest_to_provided_ipfs_backend(backend):
    if not pytest.config.getoption("--integration"):
        pytest.skip("Not asked to run integration tests")

    minified_manifest_hash = "QmVwwpt2BAkmWQt4eNnswhWd6bYgLbnUQDMHdVMHotwiqz"
    (manifest, ) = b.build(
        {},
        b.package_name("package"),
        b.manifest_version("2"),
        b.version("1.0.0"),
        b.pin_to_ipfs(backend=backend),
    )
    assert manifest["Hash"] == minified_manifest_hash
    pinned_manifest = backend.fetch_uri_contents(manifest["Hash"])
    assert (
        pinned_manifest ==
        b'{"manifest_version":"2","package_name":"package","version":"1.0.0"}')