Public Access
DEVX-108: feat: add standard label creation to configure_repo
Post-merge / detect-type (push) Successful in 16s
Post-merge / validate-commit-msg (push) Successful in 21s
Post-merge / vikunja (push) Successful in 24s
Post-merge / configure-repo (push) Successful in 17s
Post-merge / sync-wiki (push) Successful in 49s
Post-merge / release (push) Successful in 50s
Post-merge / badges (push) Successful in 58s
Build Images / detect-type (push) Successful in 1m28s
Post-merge / publish (push) Successful in 20s
Build Images / build-and-push (push) Successful in 3m2s
Build Images / cleanup (push) Successful in 3m9s
Post-merge / detect-type (push) Successful in 16s
Post-merge / validate-commit-msg (push) Successful in 21s
Post-merge / vikunja (push) Successful in 24s
Post-merge / configure-repo (push) Successful in 17s
Post-merge / sync-wiki (push) Successful in 49s
Post-merge / release (push) Successful in 50s
Post-merge / badges (push) Successful in 58s
Build Images / detect-type (push) Successful in 1m28s
Post-merge / publish (push) Successful in 20s
Build Images / build-and-push (push) Successful in 3m2s
Build Images / cleanup (push) Successful in 3m9s
This commit was merged in pull request #165.
This commit is contained in:
@@ -8,6 +8,7 @@ from click.testing import CliRunner
|
||||
|
||||
from devx.exceptions import APIError
|
||||
from devx.tools.configure_repo import (
|
||||
_STANDARD_LABELS,
|
||||
_default_branch_protection_config,
|
||||
_default_repo_settings_config,
|
||||
_handle_http_error,
|
||||
@@ -58,6 +59,7 @@ class TestConfigureRepo:
|
||||
|
||||
mock_client.ensure_branch_protection.assert_called_once()
|
||||
mock_client.update_repo_settings.assert_called_once()
|
||||
assert mock_client.ensure_label.call_count == len(_STANDARD_LABELS)
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.GiteaClient")
|
||||
@@ -100,6 +102,21 @@ class TestConfigureRepo:
|
||||
|
||||
mock_client.ensure_branch_protection.assert_called_once_with("develop", custom_bp)
|
||||
mock_client.update_repo_settings.assert_called_once_with(custom_rs)
|
||||
# Labels are created regardless of custom configs
|
||||
assert mock_client.ensure_label.call_count == len(_STANDARD_LABELS)
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.GiteaClient")
|
||||
def test_configure_repo_creates_all_standard_labels(self, mock_client_cls: MagicMock) -> None:
|
||||
"""Verify all standard labels are ensured with correct names."""
|
||||
mock_client = MagicMock()
|
||||
mock_client_cls.return_value = mock_client
|
||||
|
||||
configure_repo(token="tok", owner="owner", repo="repo")
|
||||
|
||||
created_names = [call.args[0] for call in mock_client.ensure_label.call_args_list]
|
||||
expected_names = [lbl["name"] for lbl in _STANDARD_LABELS]
|
||||
assert created_names == expected_names
|
||||
|
||||
|
||||
class TestMain:
|
||||
@@ -114,6 +131,7 @@ class TestMain:
|
||||
assert result.exit_code == 0
|
||||
mock_client.ensure_branch_protection.assert_called_once()
|
||||
mock_client.update_repo_settings.assert_called_once()
|
||||
assert mock_client.ensure_label.call_count == len(_STANDARD_LABELS)
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.GiteaClient")
|
||||
@@ -125,6 +143,7 @@ class TestMain:
|
||||
result = runner.invoke(main, ["--repo", "myrepo", "--owner", "myorg"])
|
||||
assert result.exit_code == 0
|
||||
mock_client.ensure_branch_protection.assert_called_once()
|
||||
assert mock_client.ensure_label.call_count == len(_STANDARD_LABELS)
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.GiteaClient")
|
||||
|
||||
Reference in New Issue
Block a user