aider-gitea/test/test_agit.py
Jon Michael Aanes (aider) eea96f2c61
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 21s
test: Mock secret loading in test_push_changes to avoid failures
2025-04-13 16:10:13 +02:00

32 lines
920 B
Python

def test_push_changes(monkeypatch):
captured = {}
def fake_run_cmd(cmd, cwd=None):
captured["cmd"] = cmd
monkeypatch.setattr("aider_gitea.__main__.SECRETS.load_or_fail", lambda x: "mocked_secret")
monkeypatch.setattr("aider_gitea.__main__.run_cmd", fake_run_cmd)
monkeypatch.setattr("aider_gitea.__main__.SECRETS.load_or_fail", lambda x: "mocked_secret")
branch = "feature/test-issue"
title = "Test Issue Title"
description = "Test Issue Description"
base_branch = "main"
from aider_gitea.__main__ import push_changes
push_changes(branch, title, description, base_branch)
expected_cmd = [
"git",
"push",
"origin",
f"HEAD:refs/for/{base_branch}",
"-o",
f"topic={branch}",
"-o",
f"title={title}",
"-o",
f"description={description}"
]
assert captured["cmd"] == expected_cmd