diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-04-20 00:24:09 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-04-20 00:24:09 +0200 |
commit | 12dccc4552740b4d1daa06f55e5986e4237b5856 (patch) | |
tree | 0b8135c3ef6c20f0b7f38fa2000e32c1a1918f03 /mediagoblin/tests/test_pluginapi.py | |
parent | c5d8d30182731f8e689574e096f663dcf665360d (diff) | |
download | mediagoblin-12dccc4552740b4d1daa06f55e5986e4237b5856.tar.lz mediagoblin-12dccc4552740b4d1daa06f55e5986e4237b5856.tar.xz mediagoblin-12dccc4552740b4d1daa06f55e5986e4237b5856.zip |
Refactor test configs.
All the hook_* tests use the same config, so refactor it.
Diffstat (limited to 'mediagoblin/tests/test_pluginapi.py')
-rw-r--r-- | mediagoblin/tests/test_pluginapi.py | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/mediagoblin/tests/test_pluginapi.py b/mediagoblin/tests/test_pluginapi.py index 4bbb9de4..f03e868f 100644 --- a/mediagoblin/tests/test_pluginapi.py +++ b/mediagoblin/tests/test_pluginapi.py @@ -177,19 +177,22 @@ def test_disabled_plugin(): assert len(pman.plugins) == 0 +CONFIG_ALL_CALLABLES = [ + ('mediagoblin', {}, []), + ('plugins', {}, [ + ('mediagoblin.tests.testplugins.callables1', {}, []), + ('mediagoblin.tests.testplugins.callables2', {}, []), + ('mediagoblin.tests.testplugins.callables3', {}, []), + ]) + ] + + @with_cleanup() def test_hook_handle(): """ Test the hook_handle method """ - cfg = build_config([ - ('mediagoblin', {}, []), - ('plugins', {}, [ - ('mediagoblin.tests.testplugins.callables1', {}, []), - ('mediagoblin.tests.testplugins.callables2', {}, []), - ('mediagoblin.tests.testplugins.callables3', {}, []), - ]) - ]) + cfg = build_config(CONFIG_ALL_CALLABLES) mg_globals.app_config = cfg['mediagoblin'] mg_globals.global_config = cfg @@ -233,14 +236,7 @@ def test_hook_runall(): """ Test the hook_runall method """ - cfg = build_config([ - ('mediagoblin', {}, []), - ('plugins', {}, [ - ('mediagoblin.tests.testplugins.callables1', {}, []), - ('mediagoblin.tests.testplugins.callables2', {}, []), - ('mediagoblin.tests.testplugins.callables3', {}, []), - ]) - ]) + cfg = build_config(CONFIG_ALL_CALLABLES) mg_globals.app_config = cfg['mediagoblin'] mg_globals.global_config = cfg @@ -289,14 +285,7 @@ def test_hook_transform(): """ Test the hook_transform method """ - cfg = build_config([ - ('mediagoblin', {}, []), - ('plugins', {}, [ - ('mediagoblin.tests.testplugins.callables1', {}, []), - ('mediagoblin.tests.testplugins.callables2', {}, []), - ('mediagoblin.tests.testplugins.callables3', {}, []), - ]) - ]) + cfg = build_config(CONFIG_ALL_CALLABLES) mg_globals.app_config = cfg['mediagoblin'] mg_globals.global_config = cfg |