Пример #1
0
def header_docstring(header, rfc_section):
    if header.isupper():
        header = _trans_key(header)
    major_section = rfc_section.split('.')[0]
    link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % (major_section, rfc_section)
    return "Gets and sets the ``%s`` header (`HTTP spec section %s <%s>`_)." \
        % (header, rfc_section, link)
Пример #2
0
def header_docstring(header, rfc_section):
    if header.isupper():
        header = _trans_key(header)
    major_section = rfc_section.split('.')[0]
    link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % (major_section, rfc_section)
    return "Gets and sets the ``%s`` header (`HTTP spec section %s <%s>`_)." \
        % (header, rfc_section, link)
Пример #3
0
def test__trans_key_not_a_header():
    result = headers._trans_key('')
    eq_(result, None)
Пример #4
0
def test__trans_key_not_basestring():
    result = headers._trans_key(None)
    eq_(result, None)
Пример #5
0
def test__trans_key_httpheader():
    result = headers._trans_key('HTTP_FOO_BAR')
    assert result == 'Foo-Bar'
Пример #6
0
def test__trans_key_key2header():
    result = headers._trans_key('CONTENT_TYPE')
    assert result == 'Content-Type'
Пример #7
0
def test__trans_key_not_a_header():
    result = headers._trans_key('')
    assert result == None
Пример #8
0
def test__trans_key_not_a_header():
    result = headers._trans_key("")
    assert result is None
Пример #9
0
def test__trans_key_not_basestring():
    result = headers._trans_key(None)
    eq_(result, None)
Пример #10
0
def test__trans_key_httpheader():
    result = headers._trans_key('HTTP_FOO_BAR')
    eq_(result, 'Foo-Bar')
Пример #11
0
def test__trans_key_key2header():
    result = headers._trans_key('CONTENT_TYPE')
    eq_(result, 'Content-Type')
Пример #12
0
def test__trans_key_not_a_header():
    result = headers._trans_key('')
    eq_(result, None)
Пример #13
0
def test__trans_key_httpheader():
    result = headers._trans_key("HTTP_FOO_BAR")
    assert result == "Foo-Bar"
Пример #14
0
def test__trans_key_key2header():
    result = headers._trans_key("CONTENT_TYPE")
    assert result == "Content-Type"
Пример #15
0
def test__trans_key_key2header():
    result = headers._trans_key('CONTENT_TYPE')
    eq_(result, 'Content-Type')
Пример #16
0
def test__trans_key_not_basestring():
    result = headers._trans_key(None)
    assert result == None
Пример #17
0
def test__trans_key_httpheader():
    result = headers._trans_key('HTTP_FOO_BAR')
    eq_(result, 'Foo-Bar')
Пример #18
0
def test__trans_key_not_basestring():
    result = headers._trans_key(None)
    assert result is None