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)
Example #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'
    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)
Example #4
0
    def test_html(self):

        header = 'text/html'

        _format = parse_accept_header(header)

        eq_(_format, None)
Example #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'
    def test_q_param(self):

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
    def test_wildcard(self):

        header = 'text/*'

        _format = parse_accept_header(header)

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

        header = 'text/turtle; q=0.8'

        _format = parse_accept_header(header)

        eq_(_format, 'ttl')
Example #10
0
    def test_multiple(self):

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

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Example #11
0
    def test_multiple_not_found(self):

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

        eq_(_format, None)
Example #12
0
    def test_basic_not_found(self):

        header = 'image/gif'

        _format = parse_accept_header(header)

        eq_(_format, None)
Example #13
0
    def test_basic_found(self):

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

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

        header = 'image/gif'

        _format = parse_accept_header(header)

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

        header = 'image/gif, text/unknown'

        _format = parse_accept_header(header)

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

        header = 'text/*'

        _format = parse_accept_header(header)

        assert _format in ('ttl', 'n3')
Example #21
0
    def test_double_wildcard(self):

        header = '*/*'

        _format = parse_accept_header(header)

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

    header = 'image/gif, text/unknown'

    _format = parse_accept_header(header)

    assert _format is None
Example #24
0
    def test_empty(self):

        header = ''

        _format = parse_accept_header(header)

        eq_(_format, None)
Example #25
0
def test_accept_header_q_param():

    header = 'text/turtle; q=0.8'

    _format = parse_accept_header(header)

    assert _format == 'ttl'
Example #26
0
    def test_double_wildcard(self):

        header = '*/*'

        _format = parse_accept_header(header)

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

    header = '*/*'

    _format = parse_accept_header(header)

    assert _format is None
Example #29
0
    def test_html(self):

        header = 'text/html'

        _format = parse_accept_header(header)

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

        header = 'application/rdf+xml'

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Example #32
0
def test_accept_header_basic_found():

    header = 'application/rdf+xml'

    _format = parse_accept_header(header)

    assert _format == 'rdf'
Example #33
0
    def test_multiple(self):

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

        _format = parse_accept_header(header)

        eq_(_format, 'rdf')
Example #34
0
def test_accept_header_html():

    header = 'text/html'

    _format = parse_accept_header(header)

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

    header = 'image/gif'

    _format = parse_accept_header(header)

    assert _format is None
Example #39
0
    def test_empty(self):

        header = ''

        _format = parse_accept_header(header)

        eq_(_format, None)
Example #40
0
def test_accept_header_empty():

    header = ''

    _format = parse_accept_header(header)

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

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

    _format = parse_accept_header(header)

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