summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/couch.py3
-rw-r--r--common/src/leap/soledad/common/tests/test_couch.py12
-rw-r--r--common/src/leap/soledad/common/tests/test_server.py15
3 files changed, 19 insertions, 11 deletions
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index a801a044..c2809a47 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -488,7 +488,8 @@ class CouchDatabase(CommonBackend):
security_config = security_config or {}
security = self._database.resource.get_json('_security')[2]
security['members'] = {'names': [], 'roles': []}
- security['members']['names'] = security_config.get('members', ['soledad'])
+ security['members']['names'] = security_config.get('members',
+ ['soledad'])
security['members']['roles'] = security_config.get('members_roles', [])
security['admins'] = {'names': [], 'roles': []}
security['admins']['names'] = security_config.get('admins', [])
diff --git a/common/src/leap/soledad/common/tests/test_couch.py b/common/src/leap/soledad/common/tests/test_couch.py
index 668a7f64..86cc0881 100644
--- a/common/src/leap/soledad/common/tests/test_couch.py
+++ b/common/src/leap/soledad/common/tests/test_couch.py
@@ -1530,10 +1530,14 @@ class CouchDatabaseExceptionsTests(CouchDBTestCase):
self.db.ensure_security_ddoc(configuration)
security_ddoc = self.db._database.resource.get_json('_security')[2]
- self.assertEquals(configuration['admins'], security_ddoc['admins']['names'])
- self.assertEquals(configuration['admins_roles'], security_ddoc['admins']['roles'])
- self.assertEquals(configuration['members'], security_ddoc['members']['names'])
- self.assertEquals(configuration['members_roles'], security_ddoc['members']['roles'])
+ self.assertEquals(configuration['admins'],
+ security_ddoc['admins']['names'])
+ self.assertEquals(configuration['admins_roles'],
+ security_ddoc['admins']['roles'])
+ self.assertEquals(configuration['members'],
+ security_ddoc['members']['names'])
+ self.assertEquals(configuration['members_roles'],
+ security_ddoc['members']['roles'])
class DatabaseNameValidationTest(unittest.TestCase):
diff --git a/common/src/leap/soledad/common/tests/test_server.py b/common/src/leap/soledad/common/tests/test_server.py
index 14e17e67..7c006121 100644
--- a/common/src/leap/soledad/common/tests/test_server.py
+++ b/common/src/leap/soledad/common/tests/test_server.py
@@ -22,7 +22,7 @@ import tempfile
import mock
import time
import binascii
-import pkg_resources
+from pkg_resources import resource_filename
from uuid import uuid4
from urlparse import urljoin
@@ -605,16 +605,19 @@ class ConfigurationParsingTest(unittest.TestCase):
def test_security_values_configuration(self):
# given
- config_path = pkg_resources.resource_filename('leap.soledad.common.tests',
- 'fixture_soledad.conf')
+ config_path = resource_filename('leap.soledad.common.tests',
+ 'fixture_soledad.conf')
# when
config = load_configuration(config_path)
# then
expected = {'soledad-server': {
- 'couch_url': 'http://soledad:passwd@localhost:5984',
- 'create_cmd': 'sudo -u soledad-admin /usr/bin/create-user-db',
- 'admin_netrc': '/etc/couchdb/couchdb-soledad-admin.netrc',
+ 'couch_url':
+ 'http://soledad:passwd@localhost:5984',
+ 'create_cmd':
+ 'sudo -u soledad-admin /usr/bin/create-user-db',
+ 'admin_netrc':
+ '/etc/couchdb/couchdb-soledad-admin.netrc',
},
'database-security': {
'members': ['user1', 'user2'],