DEVX-91: refactor: add find_task_by_identifier, config fallbacks for tools
This commit is contained in:
@@ -145,6 +145,7 @@ class TestMain:
|
||||
assert "CI_GITEA_TOKEN" in result.output
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.REPO_NAME", "")
|
||||
def test_main_no_repo(self) -> None:
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(main, [])
|
||||
@@ -197,3 +198,19 @@ class TestMain:
|
||||
call_args = mock_client_cls.call_args
|
||||
assert call_args[0][2] == "oblachno" # owner
|
||||
assert call_args[0][3] == "infra" # repo
|
||||
|
||||
@patch.dict("os.environ", {"CI_GITEA_TOKEN": "tok"}, clear=True)
|
||||
@patch("devx.tools.configure_repo.REPO_NAME", "devx")
|
||||
@patch("devx.tools.configure_repo.REPO_OWNER", "oblachno-oss")
|
||||
@patch("devx.tools.configure_repo.GiteaClient")
|
||||
def test_main_repo_from_pyproject(self, mock_client_cls: MagicMock) -> None:
|
||||
"""When no env var is set, repo name should come from pyproject.toml."""
|
||||
mock_client = MagicMock()
|
||||
mock_client_cls.return_value = mock_client
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(main, [])
|
||||
assert result.exit_code == 0
|
||||
call_args = mock_client_cls.call_args
|
||||
assert call_args[0][2] == "oblachno-oss" # owner
|
||||
assert call_args[0][3] == "devx" # repo
|
||||
|
||||
Reference in New Issue
Block a user