summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-01-31 14:18:09 -0200
committerdrebs <drebs@leap.se>2013-01-31 15:51:14 -0200
commitd936fbf05756b40aeb94c595ff48f5e74b07d49c (patch)
treee4c1439c337c9dbe844befa92133d3af8507b067 /src/leap
parenteba89fb1d16b33fa65b49bbf7cc0109f4d4a6a65 (diff)
Add ability to close Soledad instance.
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/soledad/__init__.py4
-rw-r--r--src/leap/soledad/tests/__init__.py4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py
index 2ed1a369..c9c981c2 100644
--- a/src/leap/soledad/__init__.py
+++ b/src/leap/soledad/__init__.py
@@ -41,6 +41,9 @@ class Soledad(object):
# for symmetric encryption.
self._db = sqlcipher.open(self.LOCAL_DB_PATH, True, self._secret)
+ def close(self):
+ self._db.close()
+
#-------------------------------------------------------------------------
# Management of secret for symmetric encryption
#-------------------------------------------------------------------------
@@ -63,6 +66,7 @@ class Soledad(object):
try:
with open(self.SECRET_PATH) as f:
self._secret = str(self._gpg.decrypt(f.read()))
+ f.close()
except IOError:
raise IOError('Failed to open secret file %s.' % self.SECRET_PATH)
diff --git a/src/leap/soledad/tests/__init__.py b/src/leap/soledad/tests/__init__.py
index 890c4d2a..3bb66680 100644
--- a/src/leap/soledad/tests/__init__.py
+++ b/src/leap/soledad/tests/__init__.py
@@ -28,7 +28,9 @@ class BaseSoledadTest(BaseLeapTest):
self._soledad._gpg.import_keys(PRIVATE_KEY)
def tearDown(self):
- pass
+ self._db1.close()
+ self._db2.close()
+ self._soledad.close()
# Key material for testing