|
1 | 1 | import inspect
|
| 2 | +import shutil |
2 | 3 | from typing import List, Optional
|
3 | 4 |
|
4 | 5 | import pytest
|
@@ -137,6 +138,27 @@ def test_get_commits_without_breakline_in_each_commit(mocker):
|
137 | 138 | )
|
138 | 139 |
|
139 | 140 |
|
| 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 | + |
140 | 162 | def test_get_tag_names_has_correct_arrow_annotation():
|
141 | 163 | arrow_annotation = inspect.getfullargspec(git.get_tag_names).annotations["return"]
|
142 | 164 |
|
|
0 commit comments