File: test_basic_app.py

package info (click to toggle)
pastedeploy 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 464 kB
  • sloc: python: 1,236; makefile: 106; sh: 17
file content (32 lines) | stat: -rw-r--r-- 1,063 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os

import fakeapp.apps

from paste.deploy import loadapp

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