Exemplo n.º 1
0
    def test_html_multiple(self):

        header = 'image/gif; q=1.0, text/html; q=0.8, text/turtle; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 2
0
def test_accept_header_q_param_multiple():

    header = 'text/turtle; q=0.8, text/n3; q=0.6'

    _format = parse_accept_header(header)

    assert _format == 'ttl'
Exemplo n.º 3
0
    def test_double_wildcard_multiple(self):

        header = 'image/gif; q=1.0, text/csv; q=0.8, */*; q=0.1'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 4
0
    def test_html(self):

        header = 'text/html'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 5
0
def test_accept_header_multiple_first_not_found():

    header = 'image/gif, application/ld+json, text/turtle'

    _format = parse_accept_header(header)

    assert _format == 'jsonld'
Exemplo n.º 6
0
    def test_q_param(self):

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 7
0
    def test_wildcard(self):

        header = 'text/*'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Exemplo n.º 8
0
    def test_multiple_first_not_found(self):

        header = 'image/gif, application/ld+json, text/turtle'

        _format = parse_accept_header(header)

        eq_(_format, 'jsonld')
Exemplo n.º 9
0
    def test_q_param(self):

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 10
0
    def test_multiple(self):

        header = 'application/rdf+xml, application/ld+json'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Exemplo n.º 11
0
    def test_multiple_not_found(self):

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 12
0
    def test_basic_not_found(self):

        header = 'image/gif'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 13
0
    def test_basic_found(self):

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Exemplo n.º 14
0
    def test_html_multiple(self):

        header = 'image/gif; q=1.0, text/html; q=0.8, text/turtle; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 15
0
    def test_basic_not_found(self):

        header = 'image/gif'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 16
0
    def test_q_param_multiple(self):

        header = 'text/turtle; q=0.8, text/n3; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 17
0
    def test_multiple_not_found(self):

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 18
0
    def test_q_param_multiple_first_not_found(self):

        header = 'image/gif; q=1.0, text/turtle; q=0.8, text/n3; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 19
0
    def test_q_param_multiple_first_not_found(self):

        header = 'image/gif; q=1.0, text/turtle; q=0.8, text/n3; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 20
0
    def test_wildcard(self):

        header = 'text/*'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Exemplo n.º 21
0
    def test_double_wildcard(self):

        header = '*/*'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 22
0
    def test_wildcard_multiple(self):

        header = 'image/gif; q=1.0, text/*; q=0.5'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Exemplo n.º 23
0
def test_accept_header_multiple_not_found():

    header = 'image/gif, text/unknown'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 24
0
    def test_empty(self):

        header = ''

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 25
0
def test_accept_header_q_param():

    header = 'text/turtle; q=0.8'

    _format = parse_accept_header(header)

    assert _format == 'ttl'
Exemplo n.º 26
0
    def test_double_wildcard(self):

        header = '*/*'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 27
0
def test_accept_header_q_param_multiple_first_not_found():

    header = 'image/gif; q=1.0, text/turtle; q=0.8, text/n3; q=0.6'

    _format = parse_accept_header(header)

    assert _format == 'ttl'
Exemplo n.º 28
0
def test_accept_header_double_wildcard():

    header = '*/*'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 29
0
    def test_html(self):

        header = 'text/html'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 30
0
def test_accept_header_double_wildcard_multiple():

    header = 'image/gif; q=1.0, text/csv; q=0.8, */*; q=0.1'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 31
0
    def test_basic_found(self):

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Exemplo n.º 32
0
def test_accept_header_basic_found():

    header = 'application/rdf+xml'

    _format = parse_accept_header(header)

    assert _format == 'rdf'
Exemplo n.º 33
0
    def test_multiple(self):

        header = 'application/rdf+xml, application/ld+json'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Exemplo n.º 34
0
def test_accept_header_html():

    header = 'text/html'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 35
0
    def test_multiple_first_not_found(self):

        header = 'image/gif, application/ld+json, text/turtle'

        _format = parse_accept_header(header)

        eq_(_format, 'jsonld')
Exemplo n.º 36
0
def test_accept_header_html_multiple():

    header = 'image/gif; q=1.0, text/html; q=0.8, text/turtle; q=0.6'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 37
0
    def test_q_param_multiple(self):

        header = 'text/turtle; q=0.8, text/n3; q=0.6'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Exemplo n.º 38
0
def test_accept_header_basic_not_found():

    header = 'image/gif'

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 39
0
    def test_empty(self):

        header = ''

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 40
0
def test_accept_header_empty():

    header = ''

    _format = parse_accept_header(header)

    assert _format is None
Exemplo n.º 41
0
    def test_wildcard_multiple(self):

        header = 'image/gif; q=1.0, text/*; q=0.5'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Exemplo n.º 42
0
def test_accept_header_multiple():

    header = 'application/rdf+xml, application/ld+json'

    _format = parse_accept_header(header)

    assert _format == 'rdf'
Exemplo n.º 43
0
    def test_double_wildcard_multiple(self):

        header = 'image/gif; q=1.0, text/csv; q=0.8, */*; q=0.1'

        _format = parse_accept_header(header)

        eq_(_format, None)
Exemplo n.º 44
0
def check_access_header():
    _format = None

    # Check Accept headers
    accept_header = toolkit.request.headers.get('Accept', '')
    if accept_header:
        _format = parse_accept_header(accept_header)
    return _format
Exemplo n.º 45
0
def check_access_header():
    _format = None

    # Check Accept headers
    accept_header = toolkit.request.headers.get('Accept', '')
    if accept_header:
        _format = parse_accept_header(accept_header)
    return _format