summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-16 14:32:49 -0300
committerdrebs <drebs@riseup.net>2017-09-20 18:55:57 -0300
commit5518364b969f764e06eec34563ae804413253107 (patch)
tree77a7afcbf476f3fd197bfc06a1ee3dbdb1f2dd74
parent3c27930bcf3ba008f555036eb877d9a634972d84 (diff)
[test] allow for custom user information on soledad_client fixture
-rw-r--r--tests/conftest.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index d3a39289..ea8dfc5c 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -317,8 +317,6 @@ def _get_certfile(url, tmpdir):
@pytest.fixture()
def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request):
- passphrase = DEFAULT_PASSPHRASE
- token = DEFAULT_TOKEN
# default values for local server
server_url = DEFAULT_URL
@@ -338,8 +336,10 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request):
soledad_dbs(default_uuid, create=create)
# get a soledad instance
- def create(force_fresh_db=False):
- secrets_file = '%s.secret' % default_uuid
+ def create(force_fresh_db=False, uuid=default_uuid,
+ passphrase=DEFAULT_PASSPHRASE, token=DEFAULT_TOKEN):
+
+ secrets_file = '%s.secret' % uuid
secrets_path = os.path.join(tmpdir.strpath, secrets_file)
# in some tests we might want to use the same user and remote database
@@ -349,11 +349,11 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request):
if force_fresh_db:
# find the next index for this user
idx = len(glob.glob('%s/*-*.db' % tmpdir.strpath)) + 1
- db_file = '%s-%d.db' % (default_uuid, idx)
+ db_file = '%s-%d.db' % (uuid, idx)
local_db_path = os.path.join(tmpdir.strpath, db_file)
soledad_client = Soledad(
- default_uuid,
+ uuid,
unicode(passphrase),
secrets_path=secrets_path,
local_db_path=local_db_path,