Beispiel #1
0
    def __init__(self, manifest: Dict[str, Any], w3: Web3 = None) -> None:
        """
        A package must be constructed with a valid manifest.
        """
        self.w3 = w3

        if not isinstance(manifest, dict):
            raise TypeError(
                "Package object must be initialized with a dictionary. "
                "Got {0}".format(type(manifest)))

        validate_manifest_against_schema(manifest)
        validate_manifest_deployments(manifest)
        check_for_build_dependencies(manifest)

        self.package_data = manifest
Beispiel #2
0
    def __init__(self, manifest: Dict[str, Any], w3: Web3) -> None:
        """
        A package should be created using one of the available
        classmethods and a valid w3 instance.
        """
        if not isinstance(manifest, dict):
            raise TypeError(
                "Package object must be initialized with a dictionary. "
                f"Got {type(manifest)}")

        validate_manifest_against_schema(manifest)
        validate_manifest_deployments(manifest)
        validate_w3_instance(w3)

        self.w3 = w3
        self.w3.eth.defaultContractFactory = LinkableContract
        self.manifest = manifest
def test_validate_deployed_contracts_pr(manifest_with_no_deployments):
    validate = validate_manifest_deployments(manifest_with_no_deployments)
    assert validate is None
def test_validate_deployments(safe_math_lib_package):
    validate = validate_manifest_deployments(safe_math_lib_package.manifest)
    assert validate is None
def test_validate_deployed_contracts_present_validates(
        manifest_with_conflicting_deployments):
    with pytest.raises(ValidationError):
        validate_manifest_deployments(manifest_with_conflicting_deployments)
def test_validate_deployments(manifest_with_matching_deployment):
    validate = validate_manifest_deployments(manifest_with_matching_deployment)
    assert validate is None