Skip to content

Commit

Permalink
[xs] Fix for autonegotiation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Mar 19, 2012
1 parent 38bc166 commit 43ca08a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ckan/lib/base.py
Expand Up @@ -66,7 +66,7 @@ def render_template():
stream = item.filter(stream)

if loader_class == NewTextTemplate:
return literal(stream.render(method="text", encoding="utf8"))
return literal(stream.render(method="text", encoding=None))
return literal(stream.render(method=method, encoding=None, strip_whitespace=False))

if 'Pragma' in response.headers:
Expand Down
20 changes: 9 additions & 11 deletions ckan/tests/functional/test_autoneg.py
Expand Up @@ -59,20 +59,18 @@ def test_html_rdf(self):
assert response.status == 200, response.status
content_type = response.header("Content-Type")
assert "html" in content_type, content_type

def test_rdfxml(self):
url = url_for(controller='package', action='read', id='annakarenina')
response = self.app.get(url, headers={"Accept": "application/rdf+xml"})
assert response.status == 303, response.status
location = response.header("Location")
assert location.endswith(".rdf"), location
assert location.startswith('http://test.com/package/'), location
assert response.status == 200, response.status
ctype = response.header("Content-Type")
assert 'application/rdf+xml' in ctype, ctype

def test_turtle(self):
def test_n3(self):
url = url_for(controller='package', action='read', id='annakarenina')
response = self.app.get(url, headers={"Accept": "application/turtle"})
assert response.status == 303, response.status
location = response.header("Location")
assert location.endswith(".ttl"), location
assert location.startswith('http://test.com/package/'), location
response = self.app.get(url, headers={"Accept": "text/n3"})
assert response.status == 200, response.status
ctype = response.header("Content-Type")
assert 'text/n3' in ctype, ctype

0 comments on commit 43ca08a

Please sign in to comment.