Browse files

[#1576][templates,tests]: Tidied up test ini files to suit postgres e…

…xtension testing and provided docs. Fixed broken util test. Corrected Statistics footer link that was appearing when no stats enabled.
  • Loading branch information...
1 parent 8457a34 commit eb245a5126d44c4ccdec6d597414b21dd2db2c2b @davidread davidread committed Jan 3, 2012
2 ckan/templates/layout_base.html
@@ -156,7 +156,7 @@ <h3 class="widget-title">Sections</h3>
- <li>
+ <li py:if="'stats' in config.get('ckan.plugins','').split(' ')">
<a href="${url('stats')}">
4 ckan/tests/functional/api/
@@ -124,7 +124,5 @@ def test_status(self):
assert_equal(res['locale_default'], 'en')
assert_equal(type(res['extensions']), list)
- expected_extensions = set()
- if not model.engine_is_sqlite():
- expected_extensions.add('synchronous_search')
+ expected_extensions = set(('stats',))
assert_equal(set(res['extensions']), expected_extensions)
4 ckan/tests/functional/
@@ -34,11 +34,13 @@ def teardown_class(self):
def test_search(self):
res ='package', action='search', q='groups:group_00'))
assert 'href="/dataset?q=groups%3Agroup_00&amp;page=2"' in res
- assert 'href="/dataset/package_19"' in res
+ assert 'href="/dataset/package_00"' in res, res
+ assert 'href="/dataset/package_19"' in res, res
res ='package', action='search', q='groups:group_00', page=2))
assert 'href="/dataset?q=groups%3Agroup_00&amp;page=1"' in res
assert 'href="/dataset/package_20"' in res
+ assert 'href="/dataset/package_39"' in res
def test_group_index(self):
res ='group', action='index'))
10 doc/common-error-messages.rst
@@ -101,3 +101,13 @@ This suggests that the config file specified with the paster ``--config`` parame
This occurs when trying to ``import migrate.exceptions`` and is due to the version of sqlalchemy-migrate being used is too old - check the requires files for the version needed.
+``ckan.plugins.core.PluginNotFoundException: stats``
+After the CKAN 1.5.1 release, the Stats extension was merged into the core CKAN code, and the ckanext namespace needs registering before the tests will run::
+ cd pyenv/src/ckan
+ python develop
+Otherwise, this problem may be to enabling an extension which is not installed. See: :doc:`extensions`_.
7 doc/test.rst
@@ -99,6 +99,13 @@ By default, tests are run using the model defined in ``ckan/model``, but by usin
A common error when wanting to run tests against a particular database is to change ``sqlalchemy.url`` in ``test.ini`` or ``test-core.ini``. The problem is that these are versioned files and people have checked in these by mistake, creating problems for other developers and the CKAN buildbot. This is easily avoided by only changing ``sqlalchemy.url`` in your local ``development.ini`` and testing ``--with-pylons=test-core.ini``.
+Testing Core Extensions
+Some extensions are in the CKAN core codebase and have their own suite of tests. For example::
+ nosetests --ckan ckanext/stats/tests
Common error messages
4 test-core.ini
@@ -45,7 +45,7 @@ search_backend = sql
# Change API key HTTP header to something non-standard.
apikey_header_name = X-Non-Standard-CKAN-API-Key
-# ckan.plugins = amqp_notifier
+ckan.plugins = stats
# use <strong> so we can check that html is *not* escaped
ckan.template_head_end = <link rel="stylesheet" href="TEST_TEMPLATE_HEAD_END.css" type="text/css">
@@ -59,6 +59,8 @@ ckan.mail_from =
ckan.locale_default = en
+ckanext.stats.cache_enabled = 0
# Logging configuration
keys = root, ckan, sqlalchemy
3 test.ini
@@ -22,12 +22,9 @@ use = config:test-core.ini
# run fast.
faster_db_test_hacks = True
sqlalchemy.url = sqlite:///
-ckan.plugins = stats
# NB: other test configuration should go in test-core.ini, which is
# what the postgres tests use.
-ckanext.stats.cache_enabled = 0
# Logging configuration
keys = root, ckan, sqlalchemy

0 comments on commit eb245a5

Please sign in to comment.