"""Test the lint CLI.""" from tests.integration.utils import run_command def test_lint_manifest() -> None: """Test lint manifest command works.""" stdout, _ = run_command( [ "poetry", "run", "pdpbackfill", "lint", "manifest", "--manifest-file-path=tests/integration/data/manifest.json", ], expected_returncode=0, ) assert "successfully validated manifest file" in stdout def test_lint_manifest_rejects_bad_file() -> None: """Test lint manifest command rejects a bad manifest.""" stdout, _ = run_command( [ "poetry", "run", "pdpbackfill", "lint", "manifest", "--manifest-file-path=tests/integration/data/bad_manifest.json", ], expected_returncode=1, ) assert "bucket must begin with dev|qa|prod|uat" in stdout assert "Input should be 'attach_and_detach'" in stdout def test_lint_manifest_uses_flag_for_checking_missing_files() -> None: """Test lint manifest command uses flag for checking missing files.""" stdout, _ = run_command( [ "poetry", "run", "pdpbackfill", "lint", "manifest", "--manifest-file-path=tests/integration/data/manifest_references_missing_file.json", "--check-keys-exist-locally", ], expected_returncode=1, ) assert "Not all keys referenced by manifest exist locally" in stdout def test_lint_manifest_does_not_auto_checking_missing_files() -> None: """Test lint manifest command does not automatically check missing files.""" stdout, _ = run_command( [ "poetry", "run", "pdpbackfill", "lint", "manifest", "--manifest-file-path=tests/integration/data/manifest_references_missing_file.json", ], expected_returncode=0, ) assert "successfully validated manifest file" in stdout