Esempio 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)
Esempio 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'
Esempio 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)
Esempio n. 4
0
    def test_html(self):

        header = 'text/html'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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'
Esempio n. 6
0
    def test_q_param(self):

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

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

        header = 'text/*'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Esempio 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')
Esempio n. 9
0
    def test_q_param(self):

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

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

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

        _format = parse_accept_header(header)

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

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

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

        header = 'image/gif'

        _format = parse_accept_header(header)

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

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Esempio 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)
Esempio n. 15
0
    def test_basic_not_found(self):

        header = 'image/gif'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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')
Esempio n. 17
0
    def test_multiple_not_found(self):

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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')
Esempio 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')
Esempio n. 20
0
    def test_wildcard(self):

        header = 'text/*'

        _format = parse_accept_header(header)

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

        header = '*/*'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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')
Esempio n. 23
0
def test_accept_header_multiple_not_found():

    header = 'image/gif, text/unknown'

    _format = parse_accept_header(header)

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

        header = ''

        _format = parse_accept_header(header)

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

    header = 'text/turtle; q=0.8'

    _format = parse_accept_header(header)

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

        header = '*/*'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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'
Esempio n. 28
0
def test_accept_header_double_wildcard():

    header = '*/*'

    _format = parse_accept_header(header)

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

        header = 'text/html'

        _format = parse_accept_header(header)

        eq_(_format, None)
Esempio 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
Esempio n. 31
0
    def test_basic_found(self):

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

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

    header = 'application/rdf+xml'

    _format = parse_accept_header(header)

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

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

        _format = parse_accept_header(header)

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

    header = 'text/html'

    _format = parse_accept_header(header)

    assert _format is None
Esempio 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')
Esempio 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
Esempio 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')
Esempio n. 38
0
def test_accept_header_basic_not_found():

    header = 'image/gif'

    _format = parse_accept_header(header)

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

        header = ''

        _format = parse_accept_header(header)

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

    header = ''

    _format = parse_accept_header(header)

    assert _format is None
Esempio 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')
Esempio n. 42
0
def test_accept_header_multiple():

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

    _format = parse_accept_header(header)

    assert _format == 'rdf'
Esempio 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)
Esempio 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
Esempio 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