# Path: test/common.py
# def generate_handler_func(route_func, path, name=None):
#     if name is None:
#         name = route_func.__name__ + '_' + {'/': 'index'}[path]
#     f = generate_route_func(name)
#     return route_func(path)(f)


from collections import namedtuple
from .common import generate_handler_func
import pytest
import tornado.testing
import rw.scope
import rw.http
import rw.routing
import rw.template
        assert routes.find_route('get', '/')[2] == index
        assert routes.find_route('post', '/')[2] == index_post
        assert routes.find_route('put', '/')[2] == index_put
        assert routes.find_route('delete', '/')[2] == index_delete

        assert routes.find_route('get', '/user/joe') == \
                                             ('', m, user, {'user_name': 'joe'})

        ## test find_route for mounts
        assert routes.find_route('get', '/sub')[2] == sub_index
        assert routes.find_route('get', '/sub2')[2] == sub2_index

        ## test url_for
        assert rw.http.url_for(index) == '/'
        assert rw.http.url_for(index_post) == '/'

        assert rw.http.url_for(user, user_name='joe') == '/user/joe'

        ## test url_for within mount
        assert rw.http.url_for(sub_index) == '/sub'
        assert rw.http.url_for(sub_fun) == '/sub/fun'
        assert rw.http.url_for(sub_posts, user_name='bob') == '/sub/bob/posts'

        ## test url_for with strings
        assert rw.http.url_for('get_index') == '/'
        assert rw.http.url_for('post_index') == '/'
        assert rw.http.url_for('user_page', user_name='joe') == '/user/joe'

        ## test url_for with strings and mount prefix
        assert rw.http.url_for('sub.get_index') == '/sub'

# Path: test/common.py
# def generate_handler_func(route_func, path, name=None):
#     if name is None:
#         name = route_func.__name__ + '_' + {'/': 'index'}[path]
#     f = generate_route_func(name)
#     return route_func(path)(f)


# Path: test/test_http.py
from collections import namedtuple
from .common import generate_handler_func
import pytest
import tornado.testing
import rw.scope
import rw.http
import rw.routing
import rw.template

        assert routes.find_route('get', '/')[2] == index
        assert routes.find_route('post', '/')[2] == index_post
        assert routes.find_route('put', '/')[2] == index_put
        assert routes.find_route('delete', '/')[2] == index_delete

        assert routes.find_route('get', '/user/joe') == \
                                             ('', m, user, {'user_name': 'joe'})

        ## test find_route for mounts
        assert routes.find_route('get', '/sub')[2] == sub_index
        assert routes.find_route('get', '/sub2')[2] == sub2_index

        ## test url_for
        assert rw.http.url_for(index) == '/'
        assert rw.http.url_for(index_post) == '/'

        assert rw.http.url_for(user, user_name='joe') == '/user/joe'

        ## test url_for within mount
        assert rw.http.url_for(sub_index) == '/sub'
        assert rw.http.url_for(sub_fun) == '/sub/fun'
        assert rw.http.url_for(sub_posts, user_name='bob') == '/sub/bob/posts'

        ## test url_for with strings
        assert rw.http.url_for('get_index') == '/'
        assert rw.http.url_for('post_index') == '/'
        assert rw.http.url_for('user_page', user_name='joe') == '/user/joe'

        ## test url_for with strings and mount prefix
        assert rw.http.url_for('sub.get_index') == '/sub'

        assert rw.http.url_for('sub.fun') == '/sub/fun'