test_main_git_ignore

This commit is contained in:
Paul Gauthier 2023-07-16 12:56:55 -03:00
parent 0f14947a4c
commit 180ca7c464
2 changed files with 17 additions and 1 deletions

View file

@ -80,6 +80,10 @@ class TestMain(TestCase):
self.assertTrue(git.Repo(self.tempdir))
gitignore = Path.cwd() / ".gitignore"
self.assertTrue(gitignore.exists())
self.assertEqual(".aider*", gitignore.read_text().splitlines()[0])
def test_check_gitignore(self):
make_repo()
io = InputOutput(pretty=False, yes=True)
@ -96,6 +100,17 @@ class TestMain(TestCase):
check_gitignore(cwd, io)
self.assertEqual("one\ntwo\n.aider*\n", gitignore.read_text())
def test_main_git_ignore(self):
cwd = Path().cwd()
self.assertFalse((cwd / ".git").exists())
self.assertFalse((cwd / ".gitignore").exists())
with patch("aider.main.Coder.create"):
main(["--yes"], input=DummyInput())
self.assertTrue((cwd / ".git").exists())
self.assertTrue((cwd / ".gitignore").exists())
def test_main_args(self):
with patch("aider.main.Coder.create") as MockCoder:
# --yes will just ok the git repo without blocking on input