Skip to content

Commit e545b0d

Browse files
gpongelliLee-W
authored andcommitted
temp key expires in 1 day
1 parent 8d55a89 commit e545b0d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,27 @@ def tmp_commitizen_project(tmp_git_project):
2727
@pytest.fixture(scope="function")
2828
def tmp_commitizen_project_with_gpg(tmp_commitizen_project):
2929
_gpg_file = tmp_commitizen_project.join("gpg_setup")
30+
_signer_mail = "joe@foo.bar"
3031
with open(_gpg_file, "w", newline="") as f:
3132
f.write("Key-Type: default" + os.linesep)
3233
f.write("Subkey-Type: default" + os.linesep)
3334
f.write("Name-Real: Joe Tester" + os.linesep)
3435
f.write("Name-Comment: with stupid passphrase" + os.linesep)
35-
f.write("Name-Email: joe@foo.bar" + os.linesep)
36-
f.write("Expire-Date: 0" + os.linesep)
36+
f.write(f"Name-Email: {_signer_mail}" + os.linesep)
37+
f.write("Expire-Date: 1" + os.linesep)
3738

3839
cmd.run(
3940
f"gpg --batch --passphrase '' --pinentry-mode loopback --generate-key {_gpg_file}"
4041
)
4142

42-
_new_key = cmd.run("gpg --list-secret-keys joe@foo.bar")
43+
_new_key = cmd.run(f"gpg --list-secret-keys {_signer_mail}")
4344
_m = re.search(
4445
rf"[a-zA-Z0-9 \[\]-_]*{os.linesep}[ ]*([0-9A-Za-z]*){os.linesep}[{os.linesep}a-zA-Z0-9 \[\]-_<>@]*",
4546
_new_key.out,
4647
)
4748
if _m:
4849
_key_id = _m.group(1)
50+
print(f"Key {_key_id} found for {_signer_mail}")
4951
cmd.run("git config --global commit.gpgsign true")
5052
cmd.run(f"git config --global user.signingkey {_key_id}")
5153

0 commit comments

Comments
 (0)