Skip to content

Commit 184c439

Browse files
committed
test(git.py): Test get_commits() with a gpg-signed commit
#397
1 parent 9eae518 commit 184c439

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_git.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import inspect
2+
import shutil
23
from typing import List, Optional
34

45
import pytest
@@ -137,6 +138,27 @@ def test_get_commits_without_breakline_in_each_commit(mocker):
137138
)
138139

139140

141+
def test_get_commits_with_signature():
142+
config_file = ".git/config"
143+
config_backup = ".git/config.bak"
144+
shutil.copy(config_file, config_backup)
145+
146+
try:
147+
# temporarily turn on --show-signature
148+
cmd.run("git config log.showsignature true")
149+
150+
# retrieve a commit that we know has a signature
151+
commit = git.get_commits(
152+
start="bec20ebf433f2281c70f1eb4b0b6a1d0ed83e9b2",
153+
end="9eae518235d051f145807ddf971ceb79ad49953a",
154+
)[0]
155+
156+
assert commit.title.startswith("fix")
157+
finally:
158+
# restore the repo's original config
159+
shutil.move(config_backup, config_file)
160+
161+
140162
def test_get_tag_names_has_correct_arrow_annotation():
141163
arrow_annotation = inspect.getfullargspec(git.get_tag_names).annotations["return"]
142164

0 commit comments

Comments
 (0)