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"])
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"])
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'])
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'])
def test_use_defaults_on_failure(self): config = load_configuration("this file will never exist") expected = CONFIG_DEFAULTS self.assertEquals(expected, config)
def test_use_defaults_on_failure(self): config = load_configuration('this file will never exist') expected = CONFIG_DEFAULTS self.assertEquals(expected, config)
""" 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')