summaryrefslogtreecommitdiff
path: root/tests/test_units/test_mapper_str.py
blob: f2a5b43b0738a0f675dc734b25f635a22fa76f7b (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()