summaryrefslogtreecommitdiff
path: root/tests/test_basic_app.py
diff options
context:
space:
mode:
authorhao huang <huang1hao@gmail.com>2015-03-28 08:10:39 +0000
committerhao huang <huang1hao@gmail.com>2015-03-28 08:10:39 +0000
commitcf7e560f89016a302342821f5071941a09c04283 (patch)
treef8b50954525cf4c063ac09597f9ac576bf92b16e /tests/test_basic_app.py
downloadpastedeploy-git-cf7e560f89016a302342821f5071941a09c04283.tar.gz
Diffstat (limited to 'tests/test_basic_app.py')
-rw-r--r--tests/test_basic_app.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_basic_app.py b/tests/test_basic_app.py
new file mode 100644
index 0000000..1ddb52b
--- /dev/null
+++ b/tests/test_basic_app.py
@@ -0,0 +1,36 @@
+from paste.deploy import loadapp
+
+from tests.fixture import *
+import fakeapp.apps
+
+
+here = os.path.dirname(__file__)
+
+
+def test_main():
+ app = loadapp('config:sample_configs/basic_app.ini',
+ relative_to=here)
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:sample_configs/basic_app.ini#main',
+ relative_to=here)
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:sample_configs/basic_app.ini',
+ relative_to=here, name='main')
+ assert app is fakeapp.apps.basic_app
+ app = loadapp('config:sample_configs/basic_app.ini#ignored',
+ relative_to=here, name='main')
+ assert app is fakeapp.apps.basic_app
+
+
+def test_other():
+ app = loadapp('config:sample_configs/basic_app.ini#other',
+ relative_to=here)
+ assert app is fakeapp.apps.basic_app2
+
+
+def test_composit():
+ app = loadapp('config:sample_configs/basic_app.ini#remote_addr',
+ relative_to=here)
+ 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