예제 #1
0
def test_multiple_manifests_found() -> None:

    with patch("dfetch.manifest.manifest.find_file") as find_file_mock:

        find_file_mock.return_value = [DEFAULT_MANIFEST_NAME, "manifest2.yaml"]

        with pytest.raises(RuntimeError):
            find_manifest()
예제 #2
0
def test_multiple_manifests_found() -> None:

    with patch("dfetch.manifest.manifest.find_file") as find_file_mock:

        find_file_mock.return_value = [DEFAULT_MANIFEST_NAME, "manifest2.yaml"]

        assert os.path.realpath(DEFAULT_MANIFEST_NAME) == find_manifest()
예제 #3
0
def test_single_manifest_found() -> None:

    with patch("dfetch.manifest.manifest.find_file") as find_file_mock:

        find_file_mock.return_value = [DEFAULT_MANIFEST_NAME]

        assert os.path.join(os.getcwd(),
                            DEFAULT_MANIFEST_NAME) == find_manifest()
예제 #4
0
    def __call__(self, args: argparse.Namespace) -> None:
        """Perform the validation."""
        del args  # unused

        manifest_path = find_manifest()
        validate(manifest_path)
        manifest_path = os.path.relpath(manifest_path, os.getcwd())
        logger.print_info_line(manifest_path, "valid")
예제 #5
0
def test_no_manifests_found() -> None:

    with patch("dfetch.manifest.manifest.find_file"):

        with pytest.raises(RuntimeError):
            find_manifest()