Skip to content

Commit

Permalink
[tests, templates] Add test for #892
Browse files Browse the repository at this point in the history
  • Loading branch information
John Glover committed Dec 20, 2011
1 parent bff538b commit d700680
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ckan/tests/functional/test_package.py
Expand Up @@ -17,6 +17,7 @@
from ckan.lib.create_test_data import CreateTestData
import ckan.lib.helpers as h
import ckan.lib.search as search
from ckan.logic.action import get, update
from ckan.controllers.package import PackageController
from ckan.plugins import SingletonPlugin, implements, IPackageController
from ckan import plugins
Expand Down Expand Up @@ -349,6 +350,21 @@ def test_read_plugin_hook(self):
assert plugin.calls['read'] == 1, plugin.calls
plugins.unload(plugin)

def test_resource_list(self):
name = 'annakarenina'
cache_url = 'http://thedatahub.org/test_cache_url.csv'
# add a cache_url to the first resource in the package
context = {'model': model, 'session': model.Session, 'user': 'testsysadmin'}
data = {'id': 'annakarenina'}
pkg = get.package_show(context, data)
pkg['resources'][0]['cache_url'] = cache_url
update.package_update(context, pkg)
# check that the cache url is included on the dataset view page
offset = url_for(controller='package', action='read', id=name)
res = self.app.get(offset)
assert '[cached]'in res
assert cache_url in res


class TestReadAtRevision(FunctionalTestCase, HtmlCheckMethods):

Expand Down

0 comments on commit d700680

Please sign in to comment.