diff --git a/ckan/tests/__init__.py b/ckan/tests/__init__.py index c61f20ba92c..66132736b95 100644 --- a/ckan/tests/__init__.py +++ b/ckan/tests/__init__.py @@ -338,3 +338,11 @@ def skip_test(*args): def clear_flash(res=None): messages = _flash.pop_messages() + +try: + from nose.tools import assert_in, assert_not_in +except ImportError: + def assert_in(a, b): + assert a in b, '%r was not in %r' % (a, b) + def assert_not_in(a, b): + assert a not in b, '%r was in %r' % (a, b) diff --git a/ckan/tests/functional/api/model/test_package.py b/ckan/tests/functional/api/model/test_package.py index 9da65586940..447acc9332f 100644 --- a/ckan/tests/functional/api/model/test_package.py +++ b/ckan/tests/functional/api/model/test_package.py @@ -245,6 +245,18 @@ def test_register_post_bad_request(self): res = self.app.post(offset, params=postparams, status=self.STATUS_400_BAD_REQUEST, extra_environ=self.extra_environ) + def test_register_post_bad_request_2(self): + test_params = { + 'name':u'testpackage07_400', + 'extras':[ # should not be a list in here + {u'key': u'value} + ], + } + offset = self.offset('/rest/dataset') + postparams = '%s=1' % self.dumps(test_params) + res = self.app.post(offset, params=postparams, status=self.STATUS_400_BAD_REQUEST, + extra_environ=self.extra_environ) + def test_register_post_denied(self): offset = self.offset('/rest/dataset') postparams = '%s=1' % self.dumps(self.package_fixture_data) diff --git a/ckan/tests/lib/test_dictization.py b/ckan/tests/lib/test_dictization.py index 64d2e80f77c..93209d377db 100644 --- a/ckan/tests/lib/test_dictization.py +++ b/ckan/tests/lib/test_dictization.py @@ -1,4 +1,4 @@ -from nose.tools import assert_equal, assert_not_in, assert_in +from ckan.tests import assert_equal, assert_not_in, assert_in from pprint import pprint, pformat from difflib import unified_diff