diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:12:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:12:28 +0000 |
commit | 49465103a1251b18df66b553af682b8bb5bde8bf (patch) | |
tree | 71fe831699689c66200a5677b5a557dd4d5565ce /tests/lint_tests | |
parent | Releasing progress-linux version 0.1.39-0.0~progress7.99u1. (diff) | |
download | debputy-49465103a1251b18df66b553af682b8bb5bde8bf.tar.xz debputy-49465103a1251b18df66b553af682b8bb5bde8bf.zip |
Merging upstream version 0.1.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lint_tests')
-rw-r--r-- | tests/lint_tests/test_lint_debputy.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/lint_tests/test_lint_debputy.py b/tests/lint_tests/test_lint_debputy.py index 2af34ae..7464cdf 100644 --- a/tests/lint_tests/test_lint_debputy.py +++ b/tests/lint_tests/test_lint_debputy.py @@ -183,3 +183,78 @@ def test_debputy_lint_check_package_names(line_linter: LintWrapper) -> None: msg = 'Unknown package "unknown-package".' assert diag.message == msg assert f"{diag.range}" == "2:4-2:19" + + +def test_debputy_lint_integration_mode(line_linter: LintWrapper) -> None: + lines = textwrap.dedent( + """\ + manifest-version: 0.1 + installations: [] + packages: + foo: + services: + - service: foo + """ + ).splitlines(keepends=True) + line_linter.dctrl_lines = textwrap.dedent( + """\ + Source: foo + Build-Depends: dh-sequence-zz-debputy-rrr, + + Package: foo + """ + ).splitlines(keepends=True) + + diagnostics = line_linter(lines) + assert diagnostics and len(diagnostics) == 2 + first_issue, second_issue = diagnostics + + msg = 'Feature "installations" not supported in integration mode dh-sequence-zz-debputy-rrr' + assert first_issue.message == msg + assert f"{first_issue.range}" == "1:0-1:13" + assert first_issue.severity == DiagnosticSeverity.Error + + msg = 'Feature "services" not supported in integration mode dh-sequence-zz-debputy-rrr' + assert second_issue.message == msg + assert f"{second_issue.range}" == "4:8-4:16" + assert second_issue.severity == DiagnosticSeverity.Error + + # Changing the integration mode should fix both + line_linter.dctrl_lines = textwrap.dedent( + """\ + Source: foo + Build-Depends: dh-sequence-zz-debputy, + + Package: foo + """ + ).splitlines(keepends=True) + diagnostics = line_linter(lines) + assert not diagnostics + + +def test_debputy_lint_attr_value_checks(line_linter: LintWrapper) -> None: + lines = textwrap.dedent( + """\ + manifest-version: 0.1 + packages: + foo: + services: + - service: foo + enable-on-install: "true" + on-upgrade: "bar" + """ + ).splitlines(keepends=True) + + diagnostics = line_linter(lines) + assert diagnostics and len(diagnostics) == 2 + first_issue, second_issue = diagnostics + + msg = 'Not a supported value for "enable-on-install"' + assert first_issue.message == msg + assert f"{first_issue.range}" == "5:29-5:35" + assert first_issue.severity == DiagnosticSeverity.Error + + msg = 'Not a supported value for "on-upgrade"' + assert second_issue.message == msg + assert f"{second_issue.range}" == "6:22-6:27" + assert second_issue.severity == DiagnosticSeverity.Error |