summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index b6cd158..6dee066 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -3,6 +3,7 @@ from nose.tools import eq_
from paste.deploy import loadapp, appconfig
from tests.fixture import *
import fakeapp.configapps as fc
+import fakeapp.apps
ini_file = 'config:sample_configs/test_config.ini'
@@ -62,6 +63,33 @@ def test_config3():
test_config2()
+def test_main():
+ app = loadapp('config:test_func.ini',
+ relative_to=config_path)
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:test_func.ini#main',
+ relative_to=config_path)
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:test_func.ini',
+ relative_to=config_path, name='main')
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:test_func.ini#ignored',
+ relative_to=config_path, name='main')
+ assert app is fakeapp.apps.basic_app
+
+
+def test_other():
+ app = loadapp('config:test_func.ini#other', relative_to=config_path)
+ assert app is fakeapp.apps.basic_app2
+
+
+def test_composit():
+ app = loadapp('config:test_func.ini#remote_addr', relative_to=config_path)
+ assert isinstance(app, fakeapp.apps.RemoteAddrDispatch)
+ assert app.map['127.0.0.1'] is fakeapp.apps.basic_app
+ assert app.map['0.0.0.0'] is fakeapp.apps.basic_app2
+
+
def test_foreign_config():
app = loadapp(ini_file, relative_to=here, name='test_foreign_config')
assert isinstance(app, fc.SimpleApp)