def test_delete_header(self): d = HeaderDict() d['Content-Type'] = 'test' d['Test'] = 'test' assert d.get('Content-Type') del d['Content-Type'] assert not d.get('Content-Type')
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'
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'