Skip to content

Commit

Permalink
Revert "[#2592] allow old and new pyutillib behaviour for tests"
Browse files Browse the repository at this point in the history
This reverts commit 8e7f6b7.
  • Loading branch information
tobes committed Jun 26, 2012
1 parent 8e7f6b7 commit 5cee502
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions ckan/tests/test_plugins.py
Expand Up @@ -168,29 +168,15 @@ def test_mapper_plugin_fired(self):
config['ckan.plugins'] = 'mapper_plugin'
plugins.load_all(config)
CreateTestData.create_arbitrary([{'name':u'testpkg'}])
# pyutillib has changed this allows old and new versions to pass
# the tests. FIXME we should sort this properly
if hasattr(PluginGlobals, 'plugin_registry'):
# old component.core==4.1
mapper_plugin = PluginGlobals.plugin_registry['MapperPlugin'].__instance__
else:
# new component.core==4.5.3
mapper_plugin = PluginGlobals.env_registry['pca'].plugin_registry['MapperPlugin'].__instance__
mapper_plugin = PluginGlobals.env_registry['pca'].plugin_registry['MapperPlugin'].__instance__
assert len(mapper_plugin.added) == 2 # resource group table added automatically
assert mapper_plugin.added[0].name == 'testpkg'

def test_routes_plugin_fired(self):
local_config = appconfig('config:%s' % config['__file__'], relative_to=conf_dir)
local_config.local_conf['ckan.plugins'] = 'routes_plugin'
app = make_app(local_config.global_conf, **local_config.local_conf)
# pyutillib has changed this allows old and new versions to pass
# the tests. FIXME we should sort this properly
if hasattr(PluginGlobals, 'plugin_registry'):
# old component.core==4.1
routes_plugin = PluginGlobals.plugin_registry['RoutesPlugin'].__instance__
else:
# new component.core==4.5.3
routes_plugin = PluginGlobals.env_registry['pca'].plugin_registry['RoutesPlugin'].__instance__
routes_plugin = PluginGlobals.env_registry['pca'].plugin_registry['RoutesPlugin'].__instance__
assert routes_plugin.calls_made == ['before_map', 'after_map'], \
routes_plugin.calls_made

0 comments on commit 5cee502

Please sign in to comment.