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_package_invalidates(): package_data = load_package_data("invalidLockfile.json") with pytest.raises(ValidationError): validate_package_against_schema(package_data)
def test_validate_package_validates(): package_data = load_package_data("validLockfile.json") assert validate_package_against_schema(package_data) is None
def test_validate_package_invalidates(invalid_package): with pytest.raises(ValidationError): validate_package_against_schema(invalid_package)
def test_validate_package_against_all_packages(all_packages): for pkg in all_packages: assert validate_package_against_schema(pkg) is None
def test_validate_package_validates(valid_package): assert validate_package_against_schema(valid_package) is None