예제 #1
0
    def __init__(self, package_data: Dict[str, Any], w3: Web3 = None) -> None:
        """
        A package must be constructed with
        parsed package JSON.
        """
        self.w3 = w3

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

        validate_package_against_schema(package_data)
        validate_package_deployments(package_data)
        check_for_build_dependencies(package_data)

        self.package_data = package_data
def test_validate_deployed_contracts_pr(lockfile_with_no_deployments):
    package_data = load_package_data(lockfile_with_no_deployments)
    validate = validate_package_deployments(package_data)
    assert validate is None
def test_validate_deployments(lockfile_with_matching_deployment):
    package_data = load_package_data(lockfile_with_matching_deployment)
    validate = validate_package_deployments(package_data)
    assert validate is None
def test_validate_deployed_contracts_present_validates(
        lockfile_with_conflicting_deployments):
    package_data = load_package_data(lockfile_with_conflicting_deployments)
    with pytest.raises(ValidationError):
        validate_package_deployments(package_data)
예제 #5
0
def test_validate_deployed_contracts_pr(package_with_no_deployments):
    validate = validate_package_deployments(package_with_no_deployments)
    assert validate is None
예제 #6
0
def test_validate_deployments(package_with_matching_deployment):
    validate = validate_package_deployments(package_with_matching_deployment)
    assert validate is None
예제 #7
0
def test_validate_deployed_contracts_present_validates(
        package_with_conflicting_deployments):
    with pytest.raises(ValidationError):
        validate_package_deployments(package_with_conflicting_deployments)