From 77c8c16a5de20d8d8ac6cf3b50eda666abfad077 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 30 Apr 2013 17:52:19 -0300 Subject: Make soledad's init arguments mandatory. --- src/leap/soledad/__init__.py | 18 ++++++------------ src/leap/soledad/tests/test_soledad.py | 1 + 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index 7d2663e8..9e920d68 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -77,12 +77,6 @@ class NotADirectory(Exception): """ -class NoServerUrl(Exception): - """ - Tried to get access to shared recovery database but there's no URL for it. - """ - - # # Soledad: local encrypted storage and remote encrypted sync. # @@ -138,9 +132,8 @@ class Soledad(object): Prefix for default values for path. """ - def __init__(self, uuid, passphrase, secret_path=None, - local_db_path=None, server_url=None, auth_token=None, - bootstrap=True): + def __init__(self, uuid, passphrase, secret_path, local_db_path, + server_url, auth_token=None, bootstrap=True): """ Initialize configuration, cryptographic keys and dbs. @@ -167,8 +160,8 @@ class Soledad(object): # TODO: allow for fingerprint enforcing. self._uuid = uuid self._passphrase = passphrase - self._set_token(auth_token) self._init_config(secret_path, local_db_path, server_url) + self._set_token(auth_token) if bootstrap: self._bootstrap() @@ -188,8 +181,9 @@ class Soledad(object): self.DEFAULT_PREFIX, 'soledad.u1db') # initialize server_url self._server_url = server_url - if self._server_url is None: - raise NoServerUrl() + leap_assert( + self._server_url is not None, + 'Missing URL for Soledad server.') # # initialization/destruction methods diff --git a/src/leap/soledad/tests/test_soledad.py b/src/leap/soledad/tests/test_soledad.py index e7d34a87..d096989e 100644 --- a/src/leap/soledad/tests/test_soledad.py +++ b/src/leap/soledad/tests/test_soledad.py @@ -66,6 +66,7 @@ class AuxMethodsTestCase(BaseSoledadTest): Test if configuration defaults point to the correct place. """ sol = Soledad('leap@leap.se', passphrase='123', bootstrap=False, + secret_path=None, local_db_path=None, server_url='') # otherwise Soledad will fail. self.assertEquals( os.path.join(sol.DEFAULT_PREFIX, 'secret.gpg'), -- cgit v1.2.3