Skip to content

Commit

Permalink
[#2063] Fix template to be detected as jinja. Convert to new tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Nov 21, 2014
1 parent c851bbc commit d8abc43
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
32 changes: 32 additions & 0 deletions ckan/new_tests/controllers/test_package.py
Expand Up @@ -178,3 +178,35 @@ def test_inexistent_resource_view_page_returns_not_found_code(self):

app = self._get_test_app()
app.get(url, status=404)


class TestPackageRead(helpers.FunctionalTestBase):
@classmethod
def setup_class(cls):
super(cls, cls).setup_class()
helpers.reset_db()

def setup(self):
model.repo.rebuild_db()

def test_read_rdf(self):
dataset1 = factories.Dataset()

offset = url_for(controller='package', action='read',
id=dataset1['name']) + ".rdf"
app = self._get_test_app()
res = app.get(offset, status=200)

assert 'dcat' in res, res
assert '{{' not in res, res

def test_read_n3(self):
dataset1 = factories.Dataset()

offset = url_for(controller='package', action='read',
id=dataset1['name']) + ".n3"
app = self._get_test_app()
res = app.get(offset, status=200)

assert 'dcat' in res, res
assert '{{' not in res, res
3 changes: 1 addition & 2 deletions ckan/templates/package/read.rdf
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:py="http://genshi.edgewall.org/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
Expand Down Expand Up @@ -69,4 +68,4 @@
</dct:relation>
{% endfor %}
</dcat:Dataset>
</rdf:RDF>
</rdf:RDF>
12 changes: 0 additions & 12 deletions ckan/tests/functional/test_package.py
Expand Up @@ -238,18 +238,6 @@ def check_link(res, controller, id):
assert 'decoy</a>' not in res, res
assert 'decoy"' not in res, res

def test_read_rdf(self):
name = 'annakarenina'
offset = url_for(controller='package', action='read', id=name) + ".rdf"
res = self.app.get(offset, status=200)
assert 'dcat' in res, res

def test_read_n3(self):
name = 'annakarenina'
offset = url_for(controller='package', action='read', id=name) + ".n3"
res = self.app.get(offset, status=200)
assert 'dcat' in res, res

def test_read_plugin_hook(self):
plugins.load('test_package_controller_plugin')
plugin = plugins.get_plugin('test_package_controller_plugin')
Expand Down

0 comments on commit d8abc43

Please sign in to comment.