Exemple #1
0
 def test_add_header(self):
     d = HeaderDict()
     d.add('CONTENT_TYPE', 'text/html')
     assert d.get('Content-Type') == 'text/html'
     assert d.get('CONTENT_TYPE') == 'text/html'
Exemple #2
0
 def test_tuple_pairs_multiple(self):
     d = HeaderDict({'Content-Type': 'text/html'})
     d.add('Content-Type', 'text/xml')
     assert d() == [('Content-Type', 'text/html'), ('Content-Type', 'text/xml')]
Exemple #3
0
 def test_add_option(self):
     d = HeaderDict()
     d.add('CONTENT_TYPE', 'text/html', charset='utf-8')
     assert d.get('Content-Type') == 'text/html; charset=utf-8'
     assert d.get_option('Content-Type', 'charset') == 'utf-8'
     assert d.get_option('Content-Type', 'random', 'test') == 'test'
Exemple #4
0
 def test_add_header(self):
     d = HeaderDict()
     d.add('CONTENT_TYPE', 'text/html')
     assert d.get('Content-Type') == 'text/html'
     assert d.get('CONTENT_TYPE') == 'text/html'
Exemple #5
0
 def test_tuple_pairs_multiple(self):
     d = HeaderDict({'Content-Type': 'text/html'})
     d.add('Content-Type', 'text/xml')
     assert d() == [('Content-Type', 'text/html'),
                    ('Content-Type', 'text/xml')]
Exemple #6
0
 def test_add_option(self):
     d = HeaderDict()
     d.add('CONTENT_TYPE', 'text/html', charset='utf-8')
     assert d.get('Content-Type') == 'text/html; charset=utf-8'
     assert d.get_option('Content-Type', 'charset') == 'utf-8'
     assert d.get_option('Content-Type', 'random', 'test') == 'test'