Ejemplo n.º 1
0
def load_system_settings():
    """Loads settings from system settings catalog."""
    system = Path('/').join('etc').join('trackit')
    try:
        with system.open() as inf:
            return load_settings(inf)
    except IOError:
        return DEFAULT
Ejemplo n.º 2
0
    def test_rmdir(self):

        folder = Path('.').join('trackit_testing_path')
        folder.makedir()
        assert folder.exists()
        foo = folder.join('foo')
        with foo.open('w') as out:
            out.write('foo')
        assert foo.exists()
        folder.rmdir()
        assert not folder.exists()
Ejemplo n.º 3
0
# Copyright (c) 2013 Robin Kåveland Hansen
#
# This file is a part of trackit. It is distributed under the terms
# of the modified BSD license. The full license is available in
# LICENSE, distributed as part of this software.

import os

from cStringIO import StringIO
from trackit.util import Path
from trackit.configuration import (
    DEFAULT, load_user_settings, dump_settings, load_settings, create_home,
    load_system_settings, load_configuration
)

target = Path('trackit_test_configuration')
config = target.join('config')

def teardown_function(func):
    if target.exists():
        target.rmdir()

def test_settings_encoder():
    file_ = StringIO()
    dump_settings(DEFAULT, file_)
    assert file_.getvalue()

def test_default_config_should_have_all_keys():
    assert 'database' in DEFAULT
    assert 'encoding' in DEFAULT