示例#1
0
    def test_security_values_configuration(self):
        # given
        config_path = resource_filename("leap.soledad.common.tests", "fixture_soledad.conf")
        # when
        config = load_configuration(config_path)

        # then
        expected = {
            "members": ["user1", "user2"],
            "members_roles": ["role1", "role2"],
            "admins": ["user3", "user4"],
            "admins_roles": ["role3", "role3"],
        }
        self.assertDictEqual(expected, config["database-security"])
示例#2
0
    def test_server_values_configuration(self):
        # given
        config_path = resource_filename("leap.soledad.common.tests", "fixture_soledad.conf")
        # when
        config = load_configuration(config_path)

        # then
        expected = {
            "couch_url": "http://*****:*****@localhost:5984",
            "create_cmd": "sudo -u soledad-admin /usr/bin/create-user-db",
            "admin_netrc": "/etc/couchdb/couchdb-soledad-admin.netrc",
            "batching": False,
        }
        self.assertDictEqual(expected, config["soledad-server"])
示例#3
0
    def test_server_values_configuration(self):
        # given
        config_path = resource_filename('leap.soledad.common.tests',
                                        'fixture_soledad.conf')
        # when
        config = load_configuration(config_path)

        # then
        expected = {
            'couch_url': 'http://*****:*****@localhost:5984',
            'create_cmd': 'sudo -u soledad-admin /usr/bin/create-user-db',
            'admin_netrc': '/etc/couchdb/couchdb-soledad-admin.netrc',
            'batching': False
        }
        self.assertDictEqual(expected, config['soledad-server'])
示例#4
0
    def test_security_values_configuration(self):
        # given
        config_path = resource_filename('leap.soledad.common.tests',
                                        'fixture_soledad.conf')
        # when
        config = load_configuration(config_path)

        # then
        expected = {
            'members': ['user1', 'user2'],
            'members_roles': ['role1', 'role2'],
            'admins': ['user3', 'user4'],
            'admins_roles': ['role3', 'role3']
        }
        self.assertDictEqual(expected, config['database-security'])
示例#5
0
 def test_use_defaults_on_failure(self):
     config = load_configuration("this file will never exist")
     expected = CONFIG_DEFAULTS
     self.assertEquals(expected, config)
示例#6
0
 def test_use_defaults_on_failure(self):
     config = load_configuration('this file will never exist')
     expected = CONFIG_DEFAULTS
     self.assertEquals(expected, config)
示例#7
0
"""

import datetime
import logging
import netrc
import os

from argparse import ArgumentParser

from leap.soledad.server import load_configuration

from migrate_couch_schema import migrate

TARGET_VERSION = '0.8.2'
DEFAULT_COUCH_URL = 'http://127.0.0.1:5984'
CONF = load_configuration('/etc/soledad/soledad-server.conf')
NETRC_PATH = CONF['soledad-server']['admin_netrc']

#
# command line args and execution
#


def _configure_logger(log_file, level=logging.INFO):
    if not log_file:
        fname, _ = os.path.basename(__file__).split('.')
        timestr = datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
        filename = 'soledad_%s_%s_%s.log' \
                   % (TARGET_VERSION, fname, timestr)
        dirname = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'log')