summaryrefslogtreecommitdiff
path: root/test/test_html_helper.py
blob: 3f8619bce3aa7787df2418b693298b5d8761d5f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest

from bottle import _parse_http_header


class TestHttpUtils(unittest.TestCase):

    # TODO: Move more of the low level http stuff here.

    def test_accept_header(self):
        self.assertEqual(_parse_http_header(
                'text/xml, text/whitespace ,'
                'application/params;param=value; ws = lots ;"quote"="mid\\"quote",'
                '"more\\"quotes\\"",'
                'I\'m in space!!!'),

                [('text/xml', {}),
                 ('text/whitespace', {}),
                 ('application/params', {'param': 'value', 'ws': 'lots', 'quote': 'mid"quote'}),
                 ('more"quotes"', {}),
                 ('I\'m in space!!!', {})]
        )