예제 #1
0
def test_main():
    app = paste_loadapp('config:test_func.ini', relative_to=config_path)
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini#main', relative_to=config_path)
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini',
                        relative_to=config_path,
                        name='main')
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini#ignored',
                        relative_to=config_path,
                        name='main')
    assert app is montague_testapps.apps.basic_app
예제 #2
0
def test_main():
    app = paste_loadapp('config:sample_configs/basic_app.ini',
                        relative_to=here)
    assert app is montague_testapps.apps.basic_app
    app = montague_loadapp(os.path.join(here, 'sample_configs/basic_app.ini'))
    assert app is montague_testapps.apps.basic_app

    app = paste_loadapp('config:sample_configs/basic_app.ini',
                        relative_to=here, name='main')
    assert app is montague_testapps.apps.basic_app
    app = montague_loadapp(os.path.join(here, 'sample_configs/basic_app.ini'),
                           name='main')
    assert app is montague_testapps.apps.basic_app
def test_main():
    app = paste_loadapp('config:test_func.ini',
                        relative_to=config_path)
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini#main',
                        relative_to=config_path)
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini',
                        relative_to=config_path, name='main')
    assert app is montague_testapps.apps.basic_app
    app = paste_loadapp('config:test_func.ini#ignored',
                        relative_to=config_path, name='main')
    assert app is montague_testapps.apps.basic_app
def test_filter_app():
    paste_app = paste_loadapp('config:sample_configs/test_filter.ini',
                              relative_to=here, name='filt')
    montague_app = montague_loadapp(
        os.path.join(here, 'sample_configs/test_filter.ini'),
        'filt')
    for app in (paste_app, montague_app):
        assert isinstance(app, montague_testapps.apps.CapFilter)
        assert app.app is montague_testapps.apps.basic_app
        assert app.method_to_call == 'lower'
예제 #5
0
def test_filter_app():
    paste_app = paste_loadapp('config:sample_configs/test_filter.ini',
                              relative_to=here,
                              name='filt')
    montague_app = montague_loadapp(
        os.path.join(here, 'sample_configs/test_filter.ini'), 'filt')
    for app in (paste_app, montague_app):
        assert isinstance(app, montague_testapps.apps.CapFilter)
        assert app.app is montague_testapps.apps.basic_app
        assert app.method_to_call == 'lower'
예제 #6
0
def test_config_get():
    app = paste_loadapp(ini_file, relative_to=here, name='test_get')
    assert isinstance(app, montague_testapps.configapps.SimpleApp)
    assert app.local_conf == {'def1': 'a', 'foo': 'TEST'}
    assert app.global_conf == {
        'def1': 'a',
        'def2': 'TEST',
        'basepath': os.path.join(here, 'sample_configs'),
        'here': config_path,
        '__file__': config_filename
    }
예제 #7
0
def test_composit():
    app = paste_loadapp('config:sample_configs/basic_app.ini',
                        relative_to=here, name='remote_addr')
    assert isinstance(app, montague_testapps.apps.RemoteAddrDispatch)
    assert app.map['127.0.0.1'] is montague_testapps.apps.basic_app
    assert app.map['0.0.0.0'] is montague_testapps.apps.basic_app2
    app = montague_loadapp(os.path.join(here, 'sample_configs/basic_app.ini'),
                           name='remote_addr')
    assert isinstance(app, montague_testapps.apps.RemoteAddrDispatch)
    assert app.map['127.0.0.1'] is montague_testapps.apps.basic_app
    assert app.map['0.0.0.0'] is montague_testapps.apps.basic_app2
def test_config_get():
    app = paste_loadapp(ini_file, relative_to=here, name='test_get')
    assert isinstance(app, montague_testapps.configapps.SimpleApp)
    assert app.local_conf == {
        'def1': 'a',
        'foo': 'TEST'}
    assert app.global_conf == {
        'def1': 'a',
        'def2': 'TEST',
        'basepath': os.path.join(here, 'sample_configs'),
        'here': config_path,
        '__file__': config_filename}
예제 #9
0
def test_foreign_config():
    app = paste_loadapp(ini_file, relative_to=here, name='test_foreign_config')
    assert isinstance(app, montague_testapps.configapps.SimpleApp)
    assert app.local_conf == {'another': 'FOO', 'bob': 'your uncle'}
    assert app.global_conf == {
        'def1': 'a',
        'def2': 'from include',
        'def3': 'c',
        'basepath': config_path,
        'glob': 'override',
        'here': config_path,
        '__file__': os.path.join(config_path, 'test_config.ini')
    }
예제 #10
0
def test_foreign_config():
    app = paste_loadapp(ini_file, relative_to=here, name='test_foreign_config')
    assert isinstance(app, montague_testapps.configapps.SimpleApp)
    assert app.local_conf == {
        'another': 'FOO',
        'bob': 'your uncle'}
    assert app.global_conf == {
        'def1': 'a',
        'def2': 'from include',
        'def3': 'c',
        'basepath': config_path,
        'glob': 'override',
        'here': config_path,
        '__file__': os.path.join(config_path, 'test_config.ini')}
예제 #11
0
def test_config1():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test1')
    montague_app = montague_loadapp(config_filename, name='test1')
    for app in (paste_app, montague_app):
        assert app.local_conf == {
            'setting1': 'foo',
            'setting2': 'bar',
            'apppath': os.path.join(config_path, 'app')}
        assert app.global_conf == {
            'def1': 'a',
            'def2': 'b',
            'basepath': config_path,
            'here': config_path,
            '__file__': config_filename}
예제 #12
0
def test_config2():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test2')
    montague_app = montague_loadapp(config_filename, name='test2')
    for app in (paste_app, montague_app):
        assert app.local_conf == {'local conf': 'something'}
        assert app.global_conf == {
            'def1': 'test2',
            'def2': 'b',
            'basepath': config_path,
            'another': 'TEST',
            'here': config_path,
            '__file__': config_filename
        }
    # Run this to make sure the global-conf-modified test2
    # didn't mess up the general global conf
    test_config1()
예제 #13
0
def test_config3():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test3')
    montague_app = montague_loadapp(config_filename, name='test3')
    for app in (paste_app, montague_app):
        assert isinstance(app, montague_testapps.configapps.SimpleApp)
        assert app.local_conf == {
            'local conf': 'something',
            'another': 'something more\nacross several\nlines'}
        assert app.global_conf == {
            'def1': 'test3',
            'def2': 'b',
            'basepath': config_path,
            'another': 'TEST',
            'here': config_path,
            '__file__': config_filename}
    test_config2()
예제 #14
0
def test_config2():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test2')
    montague_app = montague_loadapp(config_filename, name='test2')
    for app in (paste_app, montague_app):
        assert app.local_conf == {
            'local conf': 'something'}
        assert app.global_conf == {
            'def1': 'test2',
            'def2': 'b',
            'basepath': config_path,
            'another': 'TEST',
            'here': config_path,
            '__file__': config_filename}
    # Run this to make sure the global-conf-modified test2
    # didn't mess up the general global conf
    test_config1()
예제 #15
0
def test_config1():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test1')
    montague_app = montague_loadapp(config_filename, name='test1')
    for app in (paste_app, montague_app):
        assert app.local_conf == {
            'setting1': 'foo',
            'setting2': 'bar',
            'apppath': os.path.join(config_path, 'app')
        }
        assert app.global_conf == {
            'def1': 'a',
            'def2': 'b',
            'basepath': config_path,
            'here': config_path,
            '__file__': config_filename
        }
예제 #16
0
def test_config3():
    paste_app = paste_loadapp(ini_file, relative_to=here, name='test3')
    montague_app = montague_loadapp(config_filename, name='test3')
    for app in (paste_app, montague_app):
        assert isinstance(app, montague_testapps.configapps.SimpleApp)
        assert app.local_conf == {
            'local conf': 'something',
            'another': 'something more\nacross several\nlines'
        }
        assert app.global_conf == {
            'def1': 'test3',
            'def2': 'b',
            'basepath': config_path,
            'another': 'TEST',
            'here': config_path,
            '__file__': config_filename
        }
    test_config2()
예제 #17
0
def test_composit():
    app = paste_loadapp('config:test_func.ini#remote_addr', relative_to=config_path)
    assert isinstance(app, montague_testapps.apps.RemoteAddrDispatch)
    assert app.map['127.0.0.1'] is montague_testapps.apps.basic_app
    assert app.map['0.0.0.0'] is montague_testapps.apps.basic_app2
예제 #18
0
def test_other():
    app = paste_loadapp('config:test_func.ini#other', relative_to=config_path)
    assert app is montague_testapps.apps.basic_app2
예제 #19
0
def test_other():
    app = paste_loadapp('config:test_func.ini#other', relative_to=config_path)
    assert app is montague_testapps.apps.basic_app2
예제 #20
0
def test_composit():
    app = paste_loadapp('config:test_func.ini#remote_addr',
                        relative_to=config_path)
    assert isinstance(app, montague_testapps.apps.RemoteAddrDispatch)
    assert app.map['127.0.0.1'] is montague_testapps.apps.basic_app
    assert app.map['0.0.0.0'] is montague_testapps.apps.basic_app2