summaryrefslogtreecommitdiff
path: root/tests/test_units/test_mapper_str.py
blob: e6cea1b013c7155bc06629fbf31e017bbe14f52f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest
from routes import Mapper

class TestMapperStr(unittest.TestCase):
    def test_str(self):
        m = Mapper()
        m.connect('/{controller}/{action}')
        m.connect('entries', '/entries', controller='entry', action='index')
        m.connect('entry', '/entries/{id}', controller='entry', action='show')

        expected = """\
Route name Methods Path
                   /{controller}/{action}
entries            /entries
entry              /entries/{id}"""
        
        for expected_line, actual_line in zip(expected.splitlines(), str(m).splitlines()):
            assert expected_line == actual_line.rstrip()