| 1 |
import pytest |
| 2 |
|
| 3 |
import rdflib_endpoint.sparql_router |
| 4 |
|
| 5 |
accept_cases = [ |
| 6 |
("text/xml", "text/xml"), |
| 7 |
("text/rdf+xml, text/xml, */*", "text/rdf+xml"), |
| 8 |
("text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8", "text/html"), |
| 9 |
("text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=", "text/html"), |
| 10 |
("text/html;q=0.3, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8", "application/xhtml+xml"), |
| 11 |
( |
| 12 |
'text/turtle;q=0.9;profile="urn:example:profile-1", text/turtle;q=0.7;profile="urn:example:profile-2"', |
| 13 |
"text/turtle", |
| 14 |
), |
| 15 |
] |
| 16 |
|
| 17 |
|
| 18 |
@pytest.mark.parametrize("accept,expected", accept_cases) |
| 19 |
def test_accept_preference(accept, expected): |
| 20 |
pref = rdflib_endpoint.sparql_router.parse_accept_header(accept) |
| 21 |
assert pref[0] == expected |