summaryrefslogtreecommitdiff
path: root/test/test_mount.py
blob: 13af7a602e9c8a71a0264eaaada6dfb65a2711ec (plain)
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
import unittest
import sys, os.path
import bottle
import urllib2
from StringIO import StringIO
import thread
import time
from tools import ServerTestBase
from bottle import tob, touni, tonat, Bottle

class TestWsgi(ServerTestBase):
    ''' Tests sub-application support. '''
    
    def test_mount_no_plugins(self):
        def plugin(func):
            def wrapper(*a, **ka):
                return 'Plugin'
            return wrapper
        self.app.install(plugin)
        app = Bottle()
        self.app.mount(app, '/prefix')
        app.route('/foo', callback=lambda: 'bar')
        self.app.route('/foo', callback=lambda: 'baz')
        self.assertBody('Plugin', '/foo')
        self.assertBody('bar', '/prefix/foo')

if __name__ == '__main__': #pragma: no cover
    unittest.main()