From 2cc54a424281a2e7b54feca43d1ffda34af5e4f5 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Thu, 29 Aug 2019 12:41:15 +0300 Subject: [PATCH] Update tests --- ckanext/datapusher/tests/test.py | 8 ++++++-- ckanext/datastore/tests/helpers.py | 3 ++- ckanext/datastore/tests/test_dictionary.py | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ckanext/datapusher/tests/test.py b/ckanext/datapusher/tests/test.py index 942b06fdd50..cf79123e4f1 100644 --- a/ckanext/datapusher/tests/test.py +++ b/ckanext/datapusher/tests/test.py @@ -23,11 +23,13 @@ class TestDatastoreCreate(): @classmethod def setup_class(cls): + cls._original_config = dict(config) + config['ckan.plugins'] = 'datastore datapusher' + cls.app = helpers._get_test_app() if not tests.is_datastore_supported(): raise nose.SkipTest("Datastore not supported") - p.load('datastore') - p.load('datapusher') + ctd.CreateTestData.create() cls.sysadmin_user = model.User.get('testsysadmin') cls.normal_user = model.User.get('annafan') @@ -41,6 +43,8 @@ def teardown_class(cls): rebuild_all_dbs(cls.Session) p.unload('datastore') p.unload('datapusher') + config.clear() + config.update(cls._original_config) def test_create_ckan_resource_in_package(self): package = model.Package.get('annakarenina') diff --git a/ckanext/datastore/tests/helpers.py b/ckanext/datastore/tests/helpers.py index 2d6e5728736..b5fa01df802 100644 --- a/ckanext/datastore/tests/helpers.py +++ b/ckanext/datastore/tests/helpers.py @@ -92,7 +92,8 @@ class DatastoreLegacyTestBase(object): """ @classmethod def setup_class(cls): - p.load(u'datastore') + if not p.plugin_loaded(u'datastore'): + p.load(u'datastore') reset_db() search.clear_all() engine = db.get_write_engine() diff --git a/ckanext/datastore/tests/test_dictionary.py b/ckanext/datastore/tests/test_dictionary.py index a076f72574e..bcc0b6daf39 100644 --- a/ckanext/datastore/tests/test_dictionary.py +++ b/ckanext/datastore/tests/test_dictionary.py @@ -1,16 +1,16 @@ # encoding: utf-8 -from ckanext.datastore.tests.helpers import DatastoreFunctionalTestBase, DatastoreLegacyTestBase +from ckanext.datastore.tests.helpers import DatastoreFunctionalTestBase import ckan.tests.factories as factories import ckan.tests.helpers as helpers -class TestDatastoreDictionary(DatastoreLegacyTestBase): +class TestDatastoreDictionary(DatastoreFunctionalTestBase): @classmethod def setup_class(cls): - cls.app = helpers._get_test_app() super(TestDatastoreDictionary, cls).setup_class() + cls.app = helpers._get_test_app() def test_read(self): user = factories.User()