summaryrefslogtreecommitdiff
path: root/lib/crypto/gpg/writer_test.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-05-10 09:58:54 +0200
committerRobin Jarry <robin@jarry.cc>2022-05-10 14:50:49 +0200
commitb65f5649c853badcf8dad6b7be06cafed0ed70c0 (patch)
tree872dbca2fd912f40e81f9ad3f6a1e19184db9885 /lib/crypto/gpg/writer_test.go
parent43a79acdfafead3a9d23a1f5b690fda9cdf8995f (diff)
downloadaerc-b65f5649c853badcf8dad6b7be06cafed0ed70c0.zip
gpg: make tests more robust
Skip the tests if gpg is not installed. Avoid interference with the global ~/.gnupg. Automatically delete GNUPGHOME at the end of tests. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib/crypto/gpg/writer_test.go')
-rw-r--r--lib/crypto/gpg/writer_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/crypto/gpg/writer_test.go b/lib/crypto/gpg/writer_test.go
index 0f9ab10..e8defc1 100644
--- a/lib/crypto/gpg/writer_test.go
+++ b/lib/crypto/gpg/writer_test.go
@@ -16,6 +16,8 @@ func init() {
}
func TestEncrypt(t *testing.T) {
+ initGPGtest(t)
+
importPublicKey()
importSecretKey()
var h textproto.Header
@@ -55,11 +57,11 @@ func TestEncrypt(t *testing.T) {
if s := body.String(); s != wantEncrypted {
t.Errorf("Encrypt() = \n%v\n but want \n%v", s, wantEncrypted)
}
-
- t.Cleanup(CleanUp)
}
func TestSign(t *testing.T) {
+ initGPGtest(t)
+
importPublicKey()
importSecretKey()
var h textproto.Header