summaryrefslogtreecommitdiff
path: root/tickets/b6df8a5d7d3d4b7e8c2ddf8c95cfc33d/Maildir/new/1455998999.M50540P17339Q87.exolobe1
blob: 6e5a9912754ea366e5fae13333c857c3ad142b7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Return-Path: <obnam-dev-bounces@obnam.org>
X-Original-To: distix@pieni.net
Delivered-To: distix@pieni.net
Received: from bagpuss.pepperfish.net (bagpuss.pepperfish.net [148.251.8.16])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pieni.net (Postfix) with ESMTPS id 32BB52B256
	for <distix@pieni.net>; Fri, 25 Sep 2015 07:38:25 +0200 (CEST)
Received: from platypus.pepperfish.net (unknown [10.112.100.20])
	by bagpuss.pepperfish.net (Postfix) with ESMTP id DF556B9A;
	Fri, 25 Sep 2015 06:38:24 +0100 (BST)
Received: from ip6-localhost ([::1] helo=platypus.pepperfish.net)
	by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
	id 1ZfLiC-0006xJ-Pv; Fri, 25 Sep 2015 06:38:24 +0100
Received: from inmail0 ([10.112.100.10] helo=mx0.pepperfish.net)
 by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
 id 1ZfLiB-0006xC-In
 for <obnam-dev@obnam.org>; Fri, 25 Sep 2015 06:38:23 +0100
Received: from mail-io0-f180.google.com ([209.85.223.180])
 by mx0.pepperfish.net with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128)
 (Exim 4.80) (envelope-from <mathstuf@gmail.com>) id 1ZfLi9-0005Qx-TO
 for obnam-dev@obnam.org; Fri, 25 Sep 2015 06:38:23 +0100
Received: by iofb144 with SMTP id b144so100674941iof.1
 for <obnam-dev@obnam.org>; Thu, 24 Sep 2015 22:38:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=dZVK294yAIt7+5nhEGuP++/zJW5rtpF0WqYUKuZ4t3I=;
 b=QunLDCd18Pn+y2CKJTz2yyVzsrZjXSyJqBDQklFJcxoNAAS57sYKijVxjqhccIzowP
 cP4v9AJSuCYHSygdoJwmY2Qdn7PkSkJWj3i70Hf0WZbkJcIHFBKASm6Ba9RNAe426PwE
 s5/W3YO3dsi7dyxM5TAsiLy0wFLPNxBWLYJUT93Z6bqIT/thgXm8D4Hw6ptsbXfvi+sk
 NxIsxT7LL4nrN3yrZ+oQvN01ry0fn+TNiyZcoLtO/DVk1nWJaJcWV1E7u17Mo9cMSLEL
 3gNLIGECYOxtw8D+E4HH1W20Z8IcFrWRiqQ41+GBUzs/GtkSXeRHQyrHYQPf8jdLewaK
 dSdg==
X-Received: by 10.107.167.204 with SMTP id q195mr5208681ioe.119.1443159490379; 
 Thu, 24 Sep 2015 22:38:10 -0700 (PDT)
Received: from localhost (26.sub-70-209-128.myvzw.com. [70.209.128.26])
 by smtp.gmail.com with ESMTPSA id k21sm1050799ioi.10.2015.09.24.22.38.08
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 24 Sep 2015 22:38:09 -0700 (PDT)
From: Ben Boeckel <mathstuf@gmail.com>
To: obnam-dev@obnam.org
Date: Fri, 25 Sep 2015 01:37:53 -0400
Message-Id: <1443159474-27126-4-git-send-email-mathstuf@gmail.com>
X-Mailer: git-send-email 2.5.3
In-Reply-To: <1443159474-27126-1-git-send-email-mathstuf@gmail.com>
References: <1441948936-12526-1-git-send-email-mathstuf@gmail.com>
 <1443159474-27126-1-git-send-email-mathstuf@gmail.com>
X-Spam-Score: -0.5
X-Spam-Score-int: -4
X-Spam-Bar: /
X-Scanned-By: pepperfish.net, Fri, 25 Sep 2015 06:38:23 +0100
X-Spam-Report: Content analysis details: (-0.5 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.0 PPF_FROM_CONTAINS_MAIL The From header contains 'mail'
 1.2 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (mathstuf[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
 domain
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
 not necessarily valid
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
 trust [209.85.223.180 listed in list.dnswl.org]
X-ACL-Warn: message may be spam
X-Scan-Signature: 95307e19e51ef85356cdc588a20b2845
Cc: Ben Boeckel <mathstuf@gmail.com>
Subject: [PATCH v4 3/4] encryption_tests: make robust against bad default
	keyrings
X-BeenThere: obnam-dev@obnam.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Obnam development discussions <obnam-dev-obnam.org>
List-Unsubscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=unsubscribe>
List-Archive: <http://listmaster.pepperfish.net/pipermail/obnam-dev-obnam.org>
List-Post: <mailto:obnam-dev@obnam.org>
List-Help: <mailto:obnam-dev-request@obnam.org?subject=help>
List-Subscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=subscribe>
Sender: obnam-dev-bounces@obnam.org
Errors-To: obnam-dev-bounces@obnam.org

If the default keyring is not pristine, the test suite fails with errors
related to gpg not being able to read the keyring. Since the symmetric
encryption tests can use an empty keyring, make an empty directory for
it.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 obnamlib/encryption_tests.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/obnamlib/encryption_tests.py b/obnamlib/encryption_tests.py
index c695b73..86fd2fa 100644
--- a/obnamlib/encryption_tests.py
+++ b/obnamlib/encryption_tests.py
@@ -37,6 +37,12 @@ class SymmetricEncryptionTests(unittest.TestCase):
     # In these tests, we care about making sure we use the tools right,
     # not that the tools themselves work right.
 
+    def setUp(self):
+        self.gpghome = tempfile.mkdtemp()
+
+    def tearDown(self):
+        shutil.rmtree(self.gpghome)
+
     def test_generates_key_of_correct_length(self):
         numbits = 16
         key = obnamlib.generate_symmetric_key(numbits, filename='/dev/zero')
@@ -50,14 +56,17 @@ class SymmetricEncryptionTests(unittest.TestCase):
     def test_encrypts_into_different_string_than_cleartext(self):
         cleartext = 'hello world'
         key = 'sekr1t'
-        encrypted = obnamlib.encrypt_symmetric(cleartext, key)
+        encrypted = obnamlib.encrypt_symmetric(cleartext, key,
+                                               gpghome=self.gpghome)
         self.assertNotEqual(cleartext, encrypted)
 
     def test_encrypt_decrypt_round_trip(self):
         cleartext = 'hello, world'
         key = 'sekr1t'
-        encrypted = obnamlib.encrypt_symmetric(cleartext, key)
-        decrypted = obnamlib.decrypt_symmetric(encrypted, key)
+        encrypted = obnamlib.encrypt_symmetric(cleartext, key,
+                                               gpghome=self.gpghome)
+        decrypted = obnamlib.decrypt_symmetric(encrypted, key,
+                                               gpghome=self.gpghome)
         self.assertEqual(decrypted, cleartext)
 
 
-- 
2.5.3


_______________________________________________
obnam-dev mailing list
obnam-dev@obnam.org
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org