From 43ca08a5f4ff3442c4831bf029c688e1ec7f9e98 Mon Sep 17 00:00:00 2001 From: Ross Jones Date: Mon, 19 Mar 2012 15:02:12 +0000 Subject: [PATCH] [xs] Fix for autonegotiation tests --- ckan/lib/base.py | 2 +- ckan/tests/functional/test_autoneg.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ckan/lib/base.py b/ckan/lib/base.py index c4e14d71627..61ffa2e52a4 100644 --- a/ckan/lib/base.py +++ b/ckan/lib/base.py @@ -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: diff --git a/ckan/tests/functional/test_autoneg.py b/ckan/tests/functional/test_autoneg.py index 7732f7cb055..0d1181498a1 100644 --- a/ckan/tests/functional/test_autoneg.py +++ b/ckan/tests/functional/test_autoneg.py @@ -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