From a4a46d4a9cfc22324cb8a2037a5c4825f14b4b1b Mon Sep 17 00:00:00 2001 From: drebs Date: Sat, 9 Feb 2013 20:22:25 -0200 Subject: Soledad may be created without gpg/secret initialization. --- src/leap/soledad/__init__.py | 6 +++++- src/leap/soledad/tests/__init__.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/leap') diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index 688ee160..6893c7a8 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -21,13 +21,17 @@ class Soledad(object): # other configs SECRET_LENGTH = 50 - def __init__(self, user_email, gpghome=None): + def __init__(self, user_email, gpghome=None, initialize=True): self._user_email = user_email if not os.path.isdir(self.PREFIX): os.makedirs(self.PREFIX) if not gpghome: gpghome = self.GNUPG_HOME self._gpg = GPGWrapper(gpghome=gpghome) + if initialize: + self._initialize() + + def _initialize(self): # load/generate OpenPGP keypair if not self._has_openpgp_keypair(): self._gen_openpgp_keypair() diff --git a/src/leap/soledad/tests/__init__.py b/src/leap/soledad/tests/__init__.py index 3bb66680..6135e648 100644 --- a/src/leap/soledad/tests/__init__.py +++ b/src/leap/soledad/tests/__init__.py @@ -23,9 +23,11 @@ class BaseSoledadTest(BaseLeapTest): self._db2 = u1db.open(self.db2_file, create=True, document_factory=LeapDocument) # open a soledad instance - self._soledad = Soledad(self.email, gpghome=self.gnupg_home) + self._soledad = Soledad(self.email, gpghome=self.gnupg_home, + initialize=False) self._soledad._gpg.import_keys(PUBLIC_KEY) self._soledad._gpg.import_keys(PRIVATE_KEY) + self._soledad._initialize() def tearDown(self): self._db1.close() -- cgit v1.2.3