summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-10-27 10:20:56 +0100
committerVictor Shyba <victor.shyba@gmail.com>2015-10-28 18:13:40 -0300
commit7c50a100a46c69f759dc22165cec9b8098cac3a4 (patch)
treebfaf3f391b18e4ffbd8bd47412f0bddc9bdbe98e
parentf8d38125098829fe50199725545365d6d2a889a6 (diff)
[style] fix pep8 warnigs
-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
-rw-r--r--server/src/leap/soledad/server/__init__.py3
4 files changed, 21 insertions, 12 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'],
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index 4d03c82a..fe67e45f 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -306,7 +306,8 @@ def load_configuration(file_path):
if key in config[section]:
defaults[section][key] = config[section][key]
for key, value in defaults['database-security'].iteritems():
- if type(value) is not unicode: continue
+ if type(value) is not unicode:
+ continue
defaults['database-security'][key] = \
[item.strip() for item in value.split(',')]
# TODO: implement basic parsing/sanitization of options comming from