diff options
author | drebs <drebs@leap.se> | 2013-05-13 00:16:51 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-05-13 15:49:51 -0300 |
commit | 187b7c19b6f613433d192d035c26fcc016e2f493 (patch) | |
tree | 6b036c6d8a3646b3bb7859e2f982b8724fe75308 /src/leap/soledad/tests/__init__.py | |
parent | 3cefb8291c69ff4354f5b4cfde1d92117aac3d26 (diff) |
Remove bootstrap param from Soledad.
Diffstat (limited to 'src/leap/soledad/tests/__init__.py')
-rw-r--r-- | src/leap/soledad/tests/__init__.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/leap/soledad/tests/__init__.py b/src/leap/soledad/tests/__init__.py index 5cd23e45..6787aa9d 100644 --- a/src/leap/soledad/tests/__init__.py +++ b/src/leap/soledad/tests/__init__.py @@ -3,6 +3,7 @@ Tests to make sure Soledad provides U1DB functionality and more. """ import u1db +from mock import Mock from leap.soledad import Soledad @@ -37,31 +38,36 @@ class BaseSoledadTest(BaseLeapTest): document_factory=LeapDocument) # initialize soledad by hand so we can control keys self._soledad = self._soledad_instance(user=self.email) - self._soledad._init_dirs() - #self._soledad._gpg.import_keys(PUBLIC_KEY) - self._soledad._crypto = SoledadCrypto(self._soledad) - if not self._soledad._has_secret(): - self._soledad._gen_secret() - self._soledad._load_secret() - self._soledad._init_db() def tearDown(self): self._db1.close() self._db2.close() self._soledad.close() - def _soledad_instance(self, user='leap@leap.se', prefix='', - bootstrap=False, + def _soledad_instance(self, user='leap@leap.se', passphrase='123', prefix='', secrets_path=Soledad.STORAGE_SECRETS_FILE_NAME, - local_db_path='/soledad.u1db'): + local_db_path='/soledad.u1db', server_url='', + cert_file=None): + + def _put_doc_side_effect(doc): + self._doc_put = doc + + class MockSharedDB(object): + + get_doc = Mock(return_value=None) + put_doc = Mock(side_effect=_put_doc_side_effect) + + def __call__(self): + return self + + Soledad._shared_db = MockSharedDB() return Soledad( user, - '123', + passphrase, secrets_path=self.tempdir+prefix+secrets_path, local_db_path=self.tempdir+prefix+local_db_path, - server_url='', # Soledad will fail if not given an url. - cert_file=None, - bootstrap=bootstrap) + server_url=server_url, # Soledad will fail if not given an url. + cert_file=cert_file) def assertGetEncryptedDoc(self, db, doc_id, doc_rev, content, has_conflicts): """Assert that the document in the database looks correct.""" |