def test_package_from_ipfs_with_valid_uri(valid_package):
    package = Package.from_ipfs(VALID_IPFS_PKG)
    assert package.name == 'safe-math-lib'
    assert isinstance(package, Package)
def test_package_from_ipfs_rejects_invalid_ipfs_uri(invalid):
    with pytest.raises(TypeError):
        Package.from_ipfs(invalid)
def test_package_from_ipfs_with_valid_uri(monkeypatch):
    monkeypatch.setenv("ETHPM_IPFS_BACKEND_CLASS",
                       "ethpm.backends.ipfs.DummyIPFSBackend")
    package = Package.from_ipfs(VALID_IPFS_PKG)
    assert package.name == "safe-math-lib"
    assert isinstance(package, Package)