mirror of
https://github.com/ivuorinen/actions.git
synced 2026-02-05 01:43:13 +00:00
chore: add tests, update docs and actions (#299)
* docs: update documentation * feat: validate-inputs has it's own pyproject * security: mask DOCKERHUB_PASSWORD * chore: add tokens, checkout, recrete docs, integration tests * fix: add `statuses: write` permission to pr-lint
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
import argparse
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import yaml # pylint: disable=import-error
|
||||
@@ -440,13 +440,10 @@ class TestCLIFunctionality:
|
||||
"""Test main function with --dry-run flag."""
|
||||
test_args = ["update-validators.py", "--dry-run"]
|
||||
|
||||
with (
|
||||
patch("sys.argv", test_args),
|
||||
patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"generate_rules",
|
||||
) as mock_generate,
|
||||
):
|
||||
with patch("sys.argv", test_args), patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"generate_rules",
|
||||
) as mock_generate:
|
||||
main()
|
||||
mock_generate.assert_called_once()
|
||||
|
||||
@@ -454,13 +451,10 @@ class TestCLIFunctionality:
|
||||
"""Test main function with --action flag."""
|
||||
test_args = ["update-validators.py", "--action", "test-action"]
|
||||
|
||||
with (
|
||||
patch("sys.argv", test_args),
|
||||
patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"generate_rules",
|
||||
) as mock_generate,
|
||||
):
|
||||
with patch("sys.argv", test_args), patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"generate_rules",
|
||||
) as mock_generate:
|
||||
main()
|
||||
mock_generate.assert_called_once()
|
||||
|
||||
@@ -468,15 +462,11 @@ class TestCLIFunctionality:
|
||||
"""Test main function with --validate flag (success case)."""
|
||||
test_args = ["update-validators.py", "--validate"]
|
||||
|
||||
with (
|
||||
patch("sys.argv", test_args),
|
||||
patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"validate_rules_files",
|
||||
return_value=True,
|
||||
),
|
||||
patch("sys.exit") as mock_exit,
|
||||
):
|
||||
with patch("sys.argv", test_args), patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"validate_rules_files",
|
||||
return_value=True,
|
||||
), patch("sys.exit") as mock_exit:
|
||||
main()
|
||||
mock_exit.assert_called_once_with(0)
|
||||
|
||||
@@ -484,15 +474,11 @@ class TestCLIFunctionality:
|
||||
"""Test main function with --validate flag (failure case)."""
|
||||
test_args = ["update-validators.py", "--validate"]
|
||||
|
||||
with (
|
||||
patch("sys.argv", test_args),
|
||||
patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"validate_rules_files",
|
||||
return_value=False,
|
||||
),
|
||||
patch("sys.exit") as mock_exit,
|
||||
):
|
||||
with patch("sys.argv", test_args), patch.object(
|
||||
ValidationRuleGenerator,
|
||||
"validate_rules_files",
|
||||
return_value=False,
|
||||
), patch("sys.exit") as mock_exit:
|
||||
main()
|
||||
mock_exit.assert_called_once_with(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user